Imports System.IO
Imports System.Text
Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Data
Imports System.Configuration
Imports System.Resources
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Math

Imports System.Text.RegularExpressions

Imports ICSharpCode.SharpZipLib.Core
Imports ICSharpCode.SharpZipLib.Zip





Public Class Form1
    Inherits System.Windows.Forms.Form
    Dim mainJS As String
    Dim mainXML As String
    Dim manifest As String
    Dim stringsXml As String
    Dim dirName As String
    Dim projName As String
    Dim settingDir As String
    Dim skinDir As String
    Dim editDir As String
    Dim utilDir As String
    Dim wiz As New Form2
    'Dim previewFeed As New Form4
    Dim savedGadget As String
    Dim rssItemUrl, rssHTTP As String
    Dim i, j, k As Integer
    Dim grdTemp As DataGrid
    Dim detailsFeed(10) As String
    Dim titleUrlFeed(10) As String
    Dim feedUrl(10) As String
    Public Shared mainForm As Form1
    Dim feedTextColor As String
    Dim detailTextColor As String
    Dim mouseOColor As String
    Dim statusSave As Integer



    'Public mainForm As Form1


#Region "Declarations"

    Private ConnectionStateString As String

    Private Declare Function InternetGetConnectedState Lib _
            "wininet.dll" (ByRef lpSFlags As Int32, _
            ByVal dwReserved As Int32) As Boolean

    Public Enum InetConnState
        modem = &H1
        lan = &H2
        proxy = &H4
        ras = &H10
        offline = &H20
        configured = &H40
    End Enum

#End Region


    Function CheckInetConnection() As Boolean

        Dim lngFlags As Long

        If InternetGetConnectedState(lngFlags, 0) Then
            ' True
            If lngFlags And InetConnState.lan Then
                ConnectionStateString = "LAN."
                ' lblConnectStatus.Image = ImageList1.Images(1)
            ElseIf lngFlags And InetConnState.modem Then
                ConnectionStateString = "Modem."
                ' lblConnectStatus.Image = ImageList1.Images(1)
            ElseIf lngFlags And InetConnState.configured Then
                ConnectionStateString = "Configured."
                'lblConnectStatus.Image = ImageList1.Images(1)
            ElseIf lngFlags And InetConnState.proxy Then
                ConnectionStateString = "Proxy"
                'lblConnectStatus.Image = ImageList1.Images(1)
            ElseIf lngFlags And InetConnState.ras Then
                ConnectionStateString = "RAS."
                'lblConnectStatus.Image = ImageList1.Images(1)
            ElseIf lngFlags And InetConnState.offline Then
                ConnectionStateString = "Offline."
                'Me.lblConnectStatus.Image = ImageList1.Images(2)
            End If
        Else
            ' False
            ConnectionStateString = "Not Connected."
            'lblConnectStatus.Image = ImageList1.Images(3)
        End If

    End Function

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
    Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem4 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem5 As System.Windows.Forms.MenuItem
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents MenuItem7 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem8 As System.Windows.Forms.MenuItem
    Friend WithEvents projectName As System.Windows.Forms.TextBox
    Friend WithEvents feedbox As System.Windows.Forms.TextBox
    Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents interval As System.Windows.Forms.NumericUpDown
    Friend WithEvents maxentry As System.Windows.Forms.NumericUpDown
    Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
    Friend WithEvents PictureBox2 As System.Windows.Forms.PictureBox
    Friend WithEvents PictureBox3 As System.Windows.Forms.PictureBox
    Friend WithEvents PictureBox4 As System.Windows.Forms.PictureBox
    Friend WithEvents PictureBox5 As System.Windows.Forms.PictureBox
    Friend WithEvents PictureBox6 As System.Windows.Forms.PictureBox
    Friend WithEvents PictureBox7 As System.Windows.Forms.PictureBox
    Friend WithEvents PictureBox8 As System.Windows.Forms.PictureBox
    Friend WithEvents PictureBox9 As System.Windows.Forms.PictureBox
    Friend WithEvents PictureBox10 As System.Windows.Forms.PictureBox
    Friend WithEvents PictureBox11 As System.Windows.Forms.PictureBox
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents PictureBox13 As System.Windows.Forms.PictureBox
    Friend WithEvents PictureBox12 As System.Windows.Forms.PictureBox
    Friend WithEvents cache As System.Windows.Forms.CheckBox
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents saveit As System.Windows.Forms.Button
    Friend WithEvents openit As System.Windows.Forms.Button
    Friend WithEvents removeitems As System.Windows.Forms.CheckBox
    Friend WithEvents showItems As System.Windows.Forms.CheckBox
    Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox
    Friend WithEvents preview As System.Windows.Forms.Button
    Friend WithEvents grd1 As System.Windows.Forms.DataGrid
    Friend WithEvents PictureBox14 As System.Windows.Forms.PictureBox
    Friend WithEvents ListBox1 As System.Windows.Forms.ListBox
    Friend WithEvents PictureBox15 As System.Windows.Forms.PictureBox
    Friend WithEvents detFeed As System.Windows.Forms.RichTextBox
    Friend WithEvents prevBox As System.Windows.Forms.GroupBox
    Friend WithEvents detailBox As System.Windows.Forms.GroupBox
    Friend WithEvents mainBox As System.Windows.Forms.GroupBox
    Friend WithEvents genGadget As System.Windows.Forms.Button
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Timer1 As System.Windows.Forms.Timer
    Friend WithEvents Splitter1 As System.Windows.Forms.Splitter
    Friend WithEvents ToolTip1 As System.Windows.Forms.ToolTip
    Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
    Friend WithEvents Label7 As System.Windows.Forms.Label
    Friend WithEvents displaycolor As System.Windows.Forms.PictureBox
    Friend WithEvents Label8 As System.Windows.Forms.Label
    Friend WithEvents detailViewColor As System.Windows.Forms.PictureBox
    Friend WithEvents Label9 As System.Windows.Forms.Label
    Friend WithEvents mouseOverColor As System.Windows.Forms.PictureBox
    Friend WithEvents ProgressBar1 As System.Windows.Forms.ProgressBar
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
        Me.MainMenu1 = New System.Windows.Forms.MainMenu
        Me.MenuItem1 = New System.Windows.Forms.MenuItem
        Me.MenuItem2 = New System.Windows.Forms.MenuItem
        Me.MenuItem4 = New System.Windows.Forms.MenuItem
        Me.MenuItem5 = New System.Windows.Forms.MenuItem
        Me.MenuItem7 = New System.Windows.Forms.MenuItem
        Me.MenuItem8 = New System.Windows.Forms.MenuItem
        Me.Label3 = New System.Windows.Forms.Label
        Me.feedbox = New System.Windows.Forms.TextBox
        Me.Label4 = New System.Windows.Forms.Label
        Me.genGadget = New System.Windows.Forms.Button
        Me.Label5 = New System.Windows.Forms.Label
        Me.projectName = New System.Windows.Forms.TextBox
        Me.openit = New System.Windows.Forms.Button
        Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
        Me.Label6 = New System.Windows.Forms.Label
        Me.maxentry = New System.Windows.Forms.NumericUpDown
        Me.interval = New System.Windows.Forms.NumericUpDown
        Me.PictureBox1 = New System.Windows.Forms.PictureBox
        Me.PictureBox2 = New System.Windows.Forms.PictureBox
        Me.PictureBox3 = New System.Windows.Forms.PictureBox
        Me.PictureBox4 = New System.Windows.Forms.PictureBox
        Me.PictureBox5 = New System.Windows.Forms.PictureBox
        Me.PictureBox6 = New System.Windows.Forms.PictureBox
        Me.PictureBox7 = New System.Windows.Forms.PictureBox
        Me.PictureBox8 = New System.Windows.Forms.PictureBox
        Me.PictureBox9 = New System.Windows.Forms.PictureBox
        Me.PictureBox10 = New System.Windows.Forms.PictureBox
        Me.PictureBox11 = New System.Windows.Forms.PictureBox
        Me.GroupBox1 = New System.Windows.Forms.GroupBox
        Me.Label2 = New System.Windows.Forms.Label
        Me.Label1 = New System.Windows.Forms.Label
        Me.PictureBox13 = New System.Windows.Forms.PictureBox
        Me.PictureBox12 = New System.Windows.Forms.PictureBox
        Me.cache = New System.Windows.Forms.CheckBox
        Me.saveit = New System.Windows.Forms.Button
        Me.detailBox = New System.Windows.Forms.GroupBox
        Me.CheckBox1 = New System.Windows.Forms.CheckBox
        Me.showItems = New System.Windows.Forms.CheckBox
        Me.removeitems = New System.Windows.Forms.CheckBox
        Me.preview = New System.Windows.Forms.Button
        Me.grd1 = New System.Windows.Forms.DataGrid
        Me.PictureBox14 = New System.Windows.Forms.PictureBox
        Me.ListBox1 = New System.Windows.Forms.ListBox
        Me.PictureBox15 = New System.Windows.Forms.PictureBox
        Me.detFeed = New System.Windows.Forms.RichTextBox
        Me.prevBox = New System.Windows.Forms.GroupBox
        Me.Button1 = New System.Windows.Forms.Button
        Me.mainBox = New System.Windows.Forms.GroupBox
        Me.GroupBox2 = New System.Windows.Forms.GroupBox
        Me.mouseOverColor = New System.Windows.Forms.PictureBox
        Me.Label9 = New System.Windows.Forms.Label
        Me.detailViewColor = New System.Windows.Forms.PictureBox
        Me.Label8 = New System.Windows.Forms.Label
        Me.Label7 = New System.Windows.Forms.Label
        Me.displaycolor = New System.Windows.Forms.PictureBox
        Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
        Me.Splitter1 = New System.Windows.Forms.Splitter
        Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
        Me.ProgressBar1 = New System.Windows.Forms.ProgressBar
        CType(Me.maxentry, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.interval, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.GroupBox1.SuspendLayout()
        Me.detailBox.SuspendLayout()
        CType(Me.grd1, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.prevBox.SuspendLayout()
        Me.mainBox.SuspendLayout()
        Me.GroupBox2.SuspendLayout()
        Me.SuspendLayout()
        '
        'MainMenu1
        '
        Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1, Me.MenuItem7})
        '
        'MenuItem1
        '
        Me.MenuItem1.Index = 0
        Me.MenuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem2, Me.MenuItem4, Me.MenuItem5})
        Me.MenuItem1.Text = "&File"
        '
        'MenuItem2
        '
        Me.MenuItem2.Index = 0
        Me.MenuItem2.Text = "&New Gadget"
        '
        'MenuItem4
        '
        Me.MenuItem4.Index = 1
        Me.MenuItem4.Text = "&Save Gadget"
        '
        'MenuItem5
        '
        Me.MenuItem5.Index = 2
        Me.MenuItem5.Text = "E&xit"
        '
        'MenuItem7
        '
        Me.MenuItem7.Index = 1
        Me.MenuItem7.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem8})
        Me.MenuItem7.Text = "&Help"
        '
        'MenuItem8
        '
        Me.MenuItem8.Index = 0
        Me.MenuItem8.Text = "&About"
        '
        'Label3
        '
        Me.Label3.BackColor = System.Drawing.Color.Transparent
        Me.Label3.Location = New System.Drawing.Point(16, 56)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(72, 16)
        Me.Label3.TabIndex = 9
        Me.Label3.Text = "Feed URL :"
        '
        'feedbox
        '
        Me.feedbox.Location = New System.Drawing.Point(136, 56)
        Me.feedbox.Name = "feedbox"
        Me.feedbox.Size = New System.Drawing.Size(280, 21)
        Me.feedbox.TabIndex = 2
        Me.feedbox.Text = ""
        '
        'Label4
        '
        Me.Label4.BackColor = System.Drawing.Color.Transparent
        Me.Label4.Location = New System.Drawing.Point(16, 88)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(112, 40)
        Me.Label4.TabIndex = 12
        Me.Label4.Text = "Feed refresh interval in (Mintues)"
        '
        'genGadget
        '
        Me.genGadget.Location = New System.Drawing.Point(288, 448)
        Me.genGadget.Name = "genGadget"
        Me.genGadget.Size = New System.Drawing.Size(112, 32)
        Me.genGadget.TabIndex = 5
        Me.genGadget.Text = "Generate Gadget"
        '
        'Label5
        '
        Me.Label5.BackColor = System.Drawing.Color.Transparent
        Me.Label5.Location = New System.Drawing.Point(16, 24)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(88, 24)
        Me.Label5.TabIndex = 14
        Me.Label5.Text = "Project Name :"
        '
        'projectName
        '
        Me.projectName.Location = New System.Drawing.Point(136, 24)
        Me.projectName.Name = "projectName"
        Me.projectName.Size = New System.Drawing.Size(176, 21)
        Me.projectName.TabIndex = 1
        Me.projectName.Text = ""
        '
        'openit
        '
        Me.openit.Enabled = False
        Me.openit.Location = New System.Drawing.Point(624, 472)
        Me.openit.Name = "openit"
        Me.openit.Size = New System.Drawing.Size(112, 32)
        Me.openit.TabIndex = 6
        Me.openit.Text = "Open Gadget"
        '
        'ImageList1
        '
        Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16)
        Me.ImageList1.ImageStream = CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer)
        Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent
        '
        'Label6
        '
        Me.Label6.BackColor = System.Drawing.Color.Transparent
        Me.Label6.Location = New System.Drawing.Point(16, 136)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(96, 32)
        Me.Label6.TabIndex = 17
        Me.Label6.Text = "Max Entries To Display "
        '
        'maxentry
        '
        Me.maxentry.Location = New System.Drawing.Point(160, 136)
        Me.maxentry.Name = "maxentry"
        Me.maxentry.Size = New System.Drawing.Size(40, 21)
        Me.maxentry.TabIndex = 16
        Me.maxentry.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        Me.maxentry.Value = New Decimal(New Integer() {10, 0, 0, 0})
        '
        'interval
        '
        Me.interval.Location = New System.Drawing.Point(160, 88)
        Me.interval.Name = "interval"
        Me.interval.Size = New System.Drawing.Size(40, 21)
        Me.interval.TabIndex = 19
        Me.interval.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        Me.interval.Value = New Decimal(New Integer() {5, 0, 0, 0})
        '
        'PictureBox1
        '
        Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image)
        Me.PictureBox1.Location = New System.Drawing.Point(40, 504)
        Me.PictureBox1.Name = "PictureBox1"
        Me.PictureBox1.Size = New System.Drawing.Size(32, 8)
        Me.PictureBox1.TabIndex = 20
        Me.PictureBox1.TabStop = False
        Me.PictureBox1.Visible = False
        '
        'PictureBox2
        '
        Me.PictureBox2.Image = CType(resources.GetObject("PictureBox2.Image"), System.Drawing.Image)
        Me.PictureBox2.Location = New System.Drawing.Point(64, 504)
        Me.PictureBox2.Name = "PictureBox2"
        Me.PictureBox2.Size = New System.Drawing.Size(56, 8)
        Me.PictureBox2.TabIndex = 21
        Me.PictureBox2.TabStop = False
        Me.PictureBox2.Visible = False
        '
        'PictureBox3
        '
        Me.PictureBox3.Image = CType(resources.GetObject("PictureBox3.Image"), System.Drawing.Image)
        Me.PictureBox3.Location = New System.Drawing.Point(120, 504)
        Me.PictureBox3.Name = "PictureBox3"
        Me.PictureBox3.Size = New System.Drawing.Size(24, 8)
        Me.PictureBox3.TabIndex = 22
        Me.PictureBox3.TabStop = False
        Me.PictureBox3.Visible = False
        '
        'PictureBox4
        '
        Me.PictureBox4.Image = CType(resources.GetObject("PictureBox4.Image"), System.Drawing.Image)
        Me.PictureBox4.Location = New System.Drawing.Point(592, 432)
        Me.PictureBox4.Name = "PictureBox4"
        Me.PictureBox4.Size = New System.Drawing.Size(56, 64)
        Me.PictureBox4.TabIndex = 23
        Me.PictureBox4.TabStop = False
        Me.PictureBox4.Visible = False
        '
        'PictureBox5
        '
        Me.PictureBox5.Image = CType(resources.GetObject("PictureBox5.Image"), System.Drawing.Image)
        Me.PictureBox5.Location = New System.Drawing.Point(656, 432)
        Me.PictureBox5.Name = "PictureBox5"
        Me.PictureBox5.Size = New System.Drawing.Size(56, 64)
        Me.PictureBox5.TabIndex = 24
        Me.PictureBox5.TabStop = False
        Me.PictureBox5.Visible = False
        '
        'PictureBox6
        '
        Me.PictureBox6.Image = CType(resources.GetObject("PictureBox6.Image"), System.Drawing.Image)
        Me.PictureBox6.Location = New System.Drawing.Point(632, 472)
        Me.PictureBox6.Name = "PictureBox6"
        Me.PictureBox6.Size = New System.Drawing.Size(32, 32)
        Me.PictureBox6.TabIndex = 25
        Me.PictureBox6.TabStop = False
        Me.PictureBox6.Visible = False
        '
        'PictureBox7
        '
        Me.PictureBox7.Image = CType(resources.GetObject("PictureBox7.Image"), System.Drawing.Image)
        Me.PictureBox7.Location = New System.Drawing.Point(352, 520)
        Me.PictureBox7.Name = "PictureBox7"
        Me.PictureBox7.Size = New System.Drawing.Size(56, 64)
        Me.PictureBox7.TabIndex = 26
        Me.PictureBox7.TabStop = False
        Me.PictureBox7.Visible = False
        '
        'PictureBox8
        '
        Me.PictureBox8.Image = CType(resources.GetObject("PictureBox8.Image"), System.Drawing.Image)
        Me.PictureBox8.Location = New System.Drawing.Point(656, 472)
        Me.PictureBox8.Name = "PictureBox8"
        Me.PictureBox8.Size = New System.Drawing.Size(56, 32)
        Me.PictureBox8.TabIndex = 27
        Me.PictureBox8.TabStop = False
        Me.PictureBox8.Visible = False
        '
        'PictureBox9
        '
        Me.PictureBox9.Image = CType(resources.GetObject("PictureBox9.Image"), System.Drawing.Image)
        Me.PictureBox9.Location = New System.Drawing.Point(712, 472)
        Me.PictureBox9.Name = "PictureBox9"
        Me.PictureBox9.Size = New System.Drawing.Size(24, 32)
        Me.PictureBox9.TabIndex = 28
        Me.PictureBox9.TabStop = False
        Me.PictureBox9.Visible = False
        '
        'PictureBox10
        '
        Me.PictureBox10.Image = CType(resources.GetObject("PictureBox10.Image"), System.Drawing.Image)
        Me.PictureBox10.Location = New System.Drawing.Point(456, 520)
        Me.PictureBox10.Name = "PictureBox10"
        Me.PictureBox10.Size = New System.Drawing.Size(56, 64)
        Me.PictureBox10.TabIndex = 29
        Me.PictureBox10.TabStop = False
        Me.PictureBox10.Visible = False
        '
        'PictureBox11
        '
        Me.PictureBox11.Image = CType(resources.GetObject("PictureBox11.Image"), System.Drawing.Image)
        Me.PictureBox11.Location = New System.Drawing.Point(544, 512)
        Me.PictureBox11.Name = "PictureBox11"
        Me.PictureBox11.Size = New System.Drawing.Size(56, 64)
        Me.PictureBox11.TabIndex = 30
        Me.PictureBox11.TabStop = False
        Me.PictureBox11.Visible = False
        '
        'GroupBox1
        '
        Me.GroupBox1.BackColor = System.Drawing.Color.Transparent
        Me.GroupBox1.Controls.Add(Me.Label2)
        Me.GroupBox1.Controls.Add(Me.Label1)
        Me.GroupBox1.Controls.Add(Me.PictureBox13)
        Me.GroupBox1.Controls.Add(Me.PictureBox12)
        Me.GroupBox1.Location = New System.Drawing.Point(16, 192)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(152, 120)
        Me.GroupBox1.TabIndex = 31
        Me.GroupBox1.TabStop = False
        Me.GroupBox1.Text = "Gadget Icon (Only PNG)"
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(80, 64)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(40, 16)
        Me.Label2.TabIndex = 37
        Me.Label2.Text = "24x24"
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(32, 56)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(40, 16)
        Me.Label1.TabIndex = 36
        Me.Label1.Text = "32x32"
        '
        'PictureBox13
        '
        Me.PictureBox13.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.PictureBox13.Image = CType(resources.GetObject("PictureBox13.Image"), System.Drawing.Image)
        Me.PictureBox13.Location = New System.Drawing.Point(80, 80)
        Me.PictureBox13.Name = "PictureBox13"
        Me.PictureBox13.Size = New System.Drawing.Size(24, 24)
        Me.PictureBox13.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage
        Me.PictureBox13.TabIndex = 35
        Me.PictureBox13.TabStop = False
        '
        'PictureBox12
        '
        Me.PictureBox12.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.PictureBox12.Image = CType(resources.GetObject("PictureBox12.Image"), System.Drawing.Image)
        Me.PictureBox12.Location = New System.Drawing.Point(32, 72)
        Me.PictureBox12.Name = "PictureBox12"
        Me.PictureBox12.Size = New System.Drawing.Size(32, 32)
        Me.PictureBox12.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage
        Me.PictureBox12.TabIndex = 34
        Me.PictureBox12.TabStop = False
        '
        'cache
        '
        Me.cache.CheckAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.cache.Location = New System.Drawing.Point(256, 112)
        Me.cache.Name = "cache"
        Me.cache.Size = New System.Drawing.Size(136, 24)
        Me.cache.TabIndex = 32
        Me.cache.Text = "Cache Buster"
        Me.cache.ThreeState = True
        '
        'saveit
        '
        Me.saveit.Enabled = False
        Me.saveit.Location = New System.Drawing.Point(504, 464)
        Me.saveit.Name = "saveit"
        Me.saveit.Size = New System.Drawing.Size(112, 32)
        Me.saveit.TabIndex = 33
        Me.saveit.Text = "Save Gadget"
        '
        'detailBox
        '
        Me.detailBox.Controls.Add(Me.CheckBox1)
        Me.detailBox.Controls.Add(Me.showItems)
        Me.detailBox.Controls.Add(Me.removeitems)
        Me.detailBox.Location = New System.Drawing.Point(16, 360)
        Me.detailBox.Name = "detailBox"
        Me.detailBox.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.detailBox.Size = New System.Drawing.Size(440, 72)
        Me.detailBox.TabIndex = 34
        Me.detailBox.TabStop = False
        Me.detailBox.Text = "DetailsView Options"
        '
        'CheckBox1
        '
        Me.CheckBox1.CheckAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.CheckBox1.Enabled = False
        Me.CheckBox1.Location = New System.Drawing.Point(296, 32)
        Me.CheckBox1.Name = "CheckBox1"
        Me.CheckBox1.Size = New System.Drawing.Size(112, 32)
        Me.CheckBox1.TabIndex = 38
        Me.CheckBox1.Text = "Share Items"
        '
        'showItems
        '
        Me.showItems.CheckAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.showItems.Location = New System.Drawing.Point(152, 32)
        Me.showItems.Name = "showItems"
        Me.showItems.Size = New System.Drawing.Size(112, 32)
        Me.showItems.TabIndex = 37
        Me.showItems.Text = "Negative Feedback Option"
        '
        'removeitems
        '
        Me.removeitems.CheckAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.removeitems.Location = New System.Drawing.Point(16, 32)
        Me.removeitems.Name = "removeitems"
        Me.removeitems.Size = New System.Drawing.Size(104, 32)
        Me.removeitems.TabIndex = 36
        Me.removeitems.Text = "Remove Option"
        '
        'preview
        '
        Me.preview.Location = New System.Drawing.Point(48, 448)
        Me.preview.Name = "preview"
        Me.preview.Size = New System.Drawing.Size(112, 32)
        Me.preview.TabIndex = 35
        Me.preview.Text = "Preview Gadget"
        '
        'grd1
        '
        Me.grd1.DataMember = ""
        Me.grd1.HeaderForeColor = System.Drawing.SystemColors.ControlText
        Me.grd1.Location = New System.Drawing.Point(232, 528)
        Me.grd1.Name = "grd1"
        Me.grd1.Size = New System.Drawing.Size(56, 24)
        Me.grd1.TabIndex = 42
        '
        'PictureBox14
        '
        Me.PictureBox14.Image = CType(resources.GetObject("PictureBox14.Image"), System.Drawing.Image)
        Me.PictureBox14.Location = New System.Drawing.Point(16, 32)
        Me.PictureBox14.Name = "PictureBox14"
        Me.PictureBox14.Size = New System.Drawing.Size(168, 192)
        Me.PictureBox14.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
        Me.PictureBox14.TabIndex = 43
        Me.PictureBox14.TabStop = False
        '
        'ListBox1
        '
        Me.ListBox1.AccessibleRole = System.Windows.Forms.AccessibleRole.None
        Me.ListBox1.BorderStyle = System.Windows.Forms.BorderStyle.None
        Me.ListBox1.Location = New System.Drawing.Point(32, 72)
        Me.ListBox1.Name = "ListBox1"
        Me.ListBox1.ScrollAlwaysVisible = True
        Me.ListBox1.Size = New System.Drawing.Size(128, 117)
        Me.ListBox1.TabIndex = 44
        '
        'PictureBox15
        '
        Me.PictureBox15.Image = CType(resources.GetObject("PictureBox15.Image"), System.Drawing.Image)
        Me.PictureBox15.Location = New System.Drawing.Point(176, 40)
        Me.PictureBox15.Name = "PictureBox15"
        Me.PictureBox15.Size = New System.Drawing.Size(248, 240)
        Me.PictureBox15.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
        Me.PictureBox15.TabIndex = 45
        Me.PictureBox15.TabStop = False
        '
        'detFeed
        '
        Me.detFeed.BorderStyle = System.Windows.Forms.BorderStyle.None
        Me.detFeed.Location = New System.Drawing.Point(200, 104)
        Me.detFeed.Name = "detFeed"
        Me.detFeed.Size = New System.Drawing.Size(200, 152)
        Me.detFeed.TabIndex = 46
        Me.detFeed.Text = ""
        '
        'prevBox
        '
        Me.prevBox.Controls.Add(Me.Button1)
        Me.prevBox.Controls.Add(Me.ListBox1)
        Me.prevBox.Controls.Add(Me.detFeed)
        Me.prevBox.Controls.Add(Me.PictureBox14)
        Me.prevBox.Controls.Add(Me.PictureBox15)
        Me.prevBox.Location = New System.Drawing.Point(584, 24)
        Me.prevBox.Name = "prevBox"
        Me.prevBox.Size = New System.Drawing.Size(432, 320)
        Me.prevBox.TabIndex = 47
        Me.prevBox.TabStop = False
        Me.prevBox.Text = "Preview"
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(152, 280)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(144, 24)
        Me.Button1.TabIndex = 47
        Me.Button1.Text = "OK"
        '
        'mainBox
        '
        Me.mainBox.Controls.Add(Me.GroupBox2)
        Me.mainBox.Controls.Add(Me.Label5)
        Me.mainBox.Controls.Add(Me.Label3)
        Me.mainBox.Controls.Add(Me.Label4)
        Me.mainBox.Controls.Add(Me.Label6)
        Me.mainBox.Controls.Add(Me.cache)
        Me.mainBox.Controls.Add(Me.projectName)
        Me.mainBox.Controls.Add(Me.feedbox)
        Me.mainBox.Controls.Add(Me.interval)
        Me.mainBox.Controls.Add(Me.maxentry)
        Me.mainBox.Controls.Add(Me.GroupBox1)
        Me.mainBox.Location = New System.Drawing.Point(16, 8)
        Me.mainBox.Name = "mainBox"
        Me.mainBox.Size = New System.Drawing.Size(440, 328)
        Me.mainBox.TabIndex = 48
        Me.mainBox.TabStop = False
        Me.mainBox.Text = "Feed Details"
        '
        'GroupBox2
        '
        Me.GroupBox2.Controls.Add(Me.mouseOverColor)
        Me.GroupBox2.Controls.Add(Me.Label9)
        Me.GroupBox2.Controls.Add(Me.detailViewColor)
        Me.GroupBox2.Controls.Add(Me.Label8)
        Me.GroupBox2.Controls.Add(Me.Label7)
        Me.GroupBox2.Controls.Add(Me.displaycolor)
        Me.GroupBox2.Location = New System.Drawing.Point(176, 192)
        Me.GroupBox2.Name = "GroupBox2"
        Me.GroupBox2.Size = New System.Drawing.Size(248, 120)
        Me.GroupBox2.TabIndex = 33
        Me.GroupBox2.TabStop = False
        Me.GroupBox2.Text = "Color Settings"
        '
        'mouseOverColor
        '
        Me.mouseOverColor.BackColor = System.Drawing.Color.FromArgb(CType(224, Byte), CType(224, Byte), CType(224, Byte))
        Me.mouseOverColor.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.mouseOverColor.Location = New System.Drawing.Point(200, 56)
        Me.mouseOverColor.Name = "mouseOverColor"
        Me.mouseOverColor.Size = New System.Drawing.Size(32, 24)
        Me.mouseOverColor.TabIndex = 40
        Me.mouseOverColor.TabStop = False
        '
        'Label9
        '
        Me.Label9.BackColor = System.Drawing.Color.Transparent
        Me.Label9.Location = New System.Drawing.Point(8, 56)
        Me.Label9.Name = "Label9"
        Me.Label9.Size = New System.Drawing.Size(128, 16)
        Me.Label9.TabIndex = 39
        Me.Label9.Text = "Display Mouse Over "
        '
        'detailViewColor
        '
        Me.detailViewColor.BackColor = System.Drawing.Color.Black
        Me.detailViewColor.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.detailViewColor.Location = New System.Drawing.Point(200, 88)
        Me.detailViewColor.Name = "detailViewColor"
        Me.detailViewColor.Size = New System.Drawing.Size(32, 24)
        Me.detailViewColor.TabIndex = 38
        Me.detailViewColor.TabStop = False
        '
        'Label8
        '
        Me.Label8.BackColor = System.Drawing.Color.Transparent
        Me.Label8.Location = New System.Drawing.Point(8, 88)
        Me.Label8.Name = "Label8"
        Me.Label8.Size = New System.Drawing.Size(128, 24)
        Me.Label8.TabIndex = 37
        Me.Label8.Text = "Detail View Foreground"
        '
        'Label7
        '
        Me.Label7.BackColor = System.Drawing.Color.Transparent
        Me.Label7.Location = New System.Drawing.Point(8, 24)
        Me.Label7.Name = "Label7"
        Me.Label7.Size = New System.Drawing.Size(128, 24)
        Me.Label7.TabIndex = 36
        Me.Label7.Text = "Display Foreground"
        '
        'displaycolor
        '
        Me.displaycolor.BackColor = System.Drawing.Color.FromArgb(CType(224, Byte), CType(224, Byte), CType(224, Byte))
        Me.displaycolor.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.displaycolor.Location = New System.Drawing.Point(200, 24)
        Me.displaycolor.Name = "displaycolor"
        Me.displaycolor.Size = New System.Drawing.Size(32, 24)
        Me.displaycolor.TabIndex = 35
        Me.displaycolor.TabStop = False
        '
        'Timer1
        '
        Me.Timer1.Interval = 250
        '
        'Splitter1
        '
        Me.Splitter1.Location = New System.Drawing.Point(0, 0)
        Me.Splitter1.Name = "Splitter1"
        Me.Splitter1.Size = New System.Drawing.Size(3, 491)
        Me.Splitter1.TabIndex = 50
        Me.Splitter1.TabStop = False
        '
        'ProgressBar1
        '
        Me.ProgressBar1.Location = New System.Drawing.Point(16, 336)
        Me.ProgressBar1.Maximum = 200
        Me.ProgressBar1.Name = "ProgressBar1"
        Me.ProgressBar1.Size = New System.Drawing.Size(440, 24)
        Me.ProgressBar1.TabIndex = 51
        Me.ProgressBar1.Visible = False
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14)
        Me.ClientSize = New System.Drawing.Size(466, 491)
        Me.Controls.Add(Me.ProgressBar1)
        Me.Controls.Add(Me.Splitter1)
        Me.Controls.Add(Me.mainBox)
        Me.Controls.Add(Me.grd1)
        Me.Controls.Add(Me.preview)
        Me.Controls.Add(Me.detailBox)
        Me.Controls.Add(Me.saveit)
        Me.Controls.Add(Me.PictureBox11)
        Me.Controls.Add(Me.PictureBox10)
        Me.Controls.Add(Me.PictureBox9)
        Me.Controls.Add(Me.PictureBox8)
        Me.Controls.Add(Me.PictureBox7)
        Me.Controls.Add(Me.PictureBox6)
        Me.Controls.Add(Me.PictureBox5)
        Me.Controls.Add(Me.PictureBox4)
        Me.Controls.Add(Me.PictureBox3)
        Me.Controls.Add(Me.PictureBox2)
        Me.Controls.Add(Me.PictureBox1)
        Me.Controls.Add(Me.openit)
        Me.Controls.Add(Me.genGadget)
        Me.Controls.Add(Me.prevBox)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.MaximizeBox = False
        Me.Menu = Me.MainMenu1
        Me.Name = "Form1"
        Me.Text = "OneClick Feed GD Gadget Generator"
        CType(Me.maxentry, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.interval, System.ComponentModel.ISupportInitialize).EndInit()
        Me.GroupBox1.ResumeLayout(False)
        Me.detailBox.ResumeLayout(False)
        CType(Me.grd1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.prevBox.ResumeLayout(False)
        Me.mainBox.ResumeLayout(False)
        Me.GroupBox2.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub genGadget_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles genGadget.Click
        Dim dir As System.IO.Directory
        Dim folderPath = "C:\Temp\"

        If (projectName.Text.Length > 0) Then
            If (feedbox.Text.Length > 0) Then

                If wiz.ShowDialog() = DialogResult.OK Then

                    folderPath = "C:\Temp\"
                    dirName = folderPath + projectName.Text

                    projName = projectName.Text
                    dir.CreateDirectory(dirName)

                    'PART MAINDIR
                    Dim file1 As New System.IO.StreamWriter("C:\Temp\" + projectName.Text + "\main.js")
                    If (removeitems.CheckState = 1) Then
                        file1.Write(main_js("gddDetailsViewFlagRemoveButton"))
                    ElseIf (removeitems.CheckState = 0) Then
                        file1.Write(main_js("gddDetailsViewFlagToolbarOpen"))
                    End If
                    file1.Close()

                    Dim file2 As New System.IO.StreamWriter("C:\Temp\" + projectName.Text + "\main.xml")
                    file2.Write(main_xml())
                    file2.Close()

                    Dim file3 As New System.IO.StreamWriter("C:\Temp\" + projectName.Text + "\gadget.gmanifest")
                    file3.Write(gadget_gmanifest(projectName.Text))
                    file3.Close()

                    PictureBox12.Image.Save("C:\Temp\" + projectName.Text + "\icon_large.png")
                    PictureBox13.Image.Save("C:\Temp\" + projectName.Text + "\icon_small.png")


                    'PART STRINGS
                    settingDir = dirName + "\en"
                    dir.CreateDirectory(dirName + "\en")
                    Dim file4 As New System.IO.StreamWriter("C:\Temp\" + projectName.Text + "\en" + "\strings.xml")
                    file4.Write(strings_xml())
                    file4.Close()

                    'PART SKIN DIR
                    skinDir = dirName + "\default"
                    dir.CreateDirectory(dirName + "\default")
                    Dim file5 As New System.IO.StreamWriter("C:\Temp\" + projectName.Text + "\default" + "\details.css")
                    file5.Write(details_css(detailTextColor))
                    file5.Close()
                    Dim file6 As New System.IO.StreamWriter("C:\Temp\" + projectName.Text + "\default" + "\entry_item.xml")
                    file6.Write(entry_item_xml(feedTextColor))
                    file6.Close()
                    Dim file7 As New System.IO.StreamWriter("C:\Temp\" + projectName.Text + "\default" + "\title.xml")
                    file7.Write(title_xml(projectName.Text))
                    file7.Close()
                    Dim file8 As New System.IO.StreamWriter("C:\Temp\" + projectName.Text + "\default" + "\theme_config.xml")
                    file8.Write(theme_config_xml(mouseOColor))
                    file8.Close()

                    PictureBox1.Image.Save("C:\Temp\" + projectName.Text + "\default" + "\frame_BottomLeft.png")
                    PictureBox2.Image.Save("C:\Temp\" + projectName.Text + "\default" + "\frame_BottomMiddleStretch.png")
                    PictureBox3.Image.Save("C:\Temp\" + projectName.Text + "\default" + "\frame_BottomRight.png")
                    PictureBox4.Image.Save("C:\Temp\" + projectName.Text + "\default" + "\frame_MiddleLeft.png")
                    PictureBox5.Image.Save("C:\Temp\" + projectName.Text + "\default" + "\frame_MiddleRight.png")
                    PictureBox6.Image.Save("C:\Temp\" + projectName.Text + "\default" + "\frame_TopLeft.png")
                    PictureBox7.Image.Save("C:\Temp\" + projectName.Text + "\default" + "\frame_TopLogo.png")
                    PictureBox8.Image.Save("C:\Temp\" + projectName.Text + "\default" + "\frame_TopMiddleStretch.png")
                    PictureBox9.Image.Save("C:\Temp\" + projectName.Text + "\default" + "\frame_TopRight.png")
                    PictureBox10.Image.Save("C:\Temp\" + projectName.Text + "\default" + "\scrollbar_thumb.png")
                    PictureBox11.Image.Save("C:\Temp\" + projectName.Text + "\default" + "\scrollbar_track.png")

                    'EDITME PART
                    editDir = dirName + "\editme"
                    dir.CreateDirectory(editDir)

                    Dim file9 As New System.IO.StreamWriter("C:\Temp\" + projectName.Text + "\editme" + "\config_constants.js")
                    If (cache.CheckState = 1) Then
                        file9.Write(config_constants_js(feedbox.Text, interval.Value, maxentry.Value, "true"))
                    ElseIf (cache.CheckState = 0) Then
                        file9.Write(config_constants_js(feedbox.Text, interval.Value, maxentry.Value, "false"))
                    End If
                    file9.Close()

                    Dim file10 As New System.IO.StreamWriter("C:\Temp\" + projectName.Text + "\editme" + "\entry_item_impl.js")
                    file10.Write(entry_item_impl_js())
                    file10.Close()

                    'UTILS PART
                    utilDir = dirName + "\utils_js"
                    dir.CreateDirectory(utilDir)

                    Dim file11 As New System.IO.StreamWriter("C:\Temp\" + projectName.Text + "\utils_js" + "\entry_list.js")
                    file11.Write(entry_list_js())
                    file11.Close()
                    Dim file12 As New System.IO.StreamWriter("C:\Temp\" + projectName.Text + "\utils_js" + "\parsers.js")
                    file12.Write(parsers_js())
                    file12.Close()
                    Dim file13 As New System.IO.StreamWriter("C:\Temp\" + projectName.Text + "\utils_js" + "\utils.js")
                    file13.Write(utils_js())
                    file13.Close()

                    MenuItem4.Enabled = True
                    saveit.Enabled = True
                    MessageBox.Show("Generated Successfully", "Google Desktop Gadget", MessageBoxButtons.OK, MessageBoxIcon.Information)
                    'must save
                    statusSave = 0

                    'ElseIf wiz.ShowDialog() = DialogResult.Cancel Then
                    'MessageBox.Show("You Must fill these fields", "Google Desktop Gadget", MessageBoxButtons.OK, MessageBoxIcon.Information)
                End If
            End If
        ElseIf (projectName.Text.Length <= 0) Then
            MessageBox.Show("Please Enter Project Name,URL", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning)
            Exit Sub
        ElseIf (feedbox.Text.Length <= 0) Then
            MessageBox.Show("Please Enter Project Name,URL", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning)
            Exit Sub
        End If

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        displaycolor.BackColor = displaycolor.BackColor.FromArgb(50, 63, 76)
        mouseOverColor.BackColor = mouseOverColor.BackColor.FromArgb(238, 238, 238)
        feedTextColor = GetWebColor(displaycolor.BackColor.ToArgb())
        detailTextColor = GetWebColor(detailViewColor.BackColor.ToArgb)
        mouseOColor = GetWebColor(mouseOverColor.BackColor.ToArgb)
        MenuItem4.Enabled = False
        openit.Enabled = False
        saveit.Enabled = False
        Dim blnState As Boolean
        blnState = CheckInetConnection()
        prevBox.SetBounds(12, 8, 432, 320)
        'feedbox.Text = "http://rss.news.yahoo.com/rss/topstories"
        'projectName.Text = "Feed"
        'statusLoad.SetBounds(40, 21, 208, 24)
        statusSave = 1

        prevBox.Visible = False
    End Sub

    Private Sub MenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem4.Click
        Dim DirectoryBrowser As System.Windows.Forms.FolderBrowserDialog
        DirectoryBrowser = New System.Windows.Forms.FolderBrowserDialog
        DirectoryBrowser.Description = "Save Gadget in ..."
        If (DirectoryBrowser.ShowDialog() = Windows.Forms.DialogResult.OK) Then
            '    ' Console.WriteLine(DirectoryBrowser.SelectedPath)

            Dim fz As New ICSharpCode.SharpZipLib.Zip.FastZip
            fz.CreateZip(DirectoryBrowser.SelectedPath + "\" + projName + ".gg", dirName, True, "", "")

            '    Dim astrFileNames() As String = Directory.GetFiles(dirName)
            '    Dim astrFileNames1() As String = Directory.GetFiles(settingDir)
            '    Dim astrFileNames2() As String = Directory.GetFiles(skinDir)
            '    Dim astrFileNames3() As String = Directory.GetFiles(editDir)
            '    Dim astrFileNames4() As String = Directory.GetFiles(utilDir)

            '    Dim strmZipOutputStream As ZipOutputStream


            '    strmZipOutputStream = New ZipOutputStream(File.Create(DirectoryBrowser.SelectedPath + "\" + projName + ".gg"))
            '    strmZipOutputStream.SetLevel(9)
            '    Dim strFile As String

            '    For Each strFile In astrFileNames

            '        Dim strmFile As FileStream = File.OpenRead(strFile)

            '        Dim abyBuffer(strmFile.Length - 1) As Byte

            '        strmFile.Read(abyBuffer, 0, abyBuffer.Length)

            '        Dim objZipEntry As ZipEntry = New ZipEntry(Path.GetFileName(strFile))

            '        objZipEntry.DateTime = DateTime.Now
            '        objZipEntry.Size = strmFile.Length
            '        strmFile.Close()
            '        strmZipOutputStream.PutNextEntry(objZipEntry)
            '        strmZipOutputStream.Write(abyBuffer, 0, abyBuffer.Length)

            '    Next

            '    For Each strFile In astrFileNames1
            '        Dim strmFile As FileStream = File.OpenRead(strFile)
            '        Dim abyBuffer(strmFile.Length - 1) As Byte

            '        strmFile.Read(abyBuffer, 0, abyBuffer.Length)


            '        Dim objZipEntry As ZipEntry = New ZipEntry("en\" + Path.GetFileName(strFile))

            '        objZipEntry.DateTime = DateTime.Now
            '        objZipEntry.Size = strmFile.Length
            '        strmFile.Close()
            '        strmZipOutputStream.PutNextEntry(objZipEntry)
            '        strmZipOutputStream.Write(abyBuffer, 0, abyBuffer.Length)
            '    Next

            '    For Each strFile In astrFileNames2
            '        Dim strmFile As FileStream = File.OpenRead(strFile)
            '        Dim abyBuffer(strmFile.Length - 1) As Byte

            '        strmFile.Read(abyBuffer, 0, abyBuffer.Length)


            '        Dim objZipEntry As ZipEntry = New ZipEntry("default\" + Path.GetFileName(strFile))

            '        objZipEntry.DateTime = DateTime.Now
            '        objZipEntry.Size = strmFile.Length
            '        strmFile.Close()
            '        strmZipOutputStream.PutNextEntry(objZipEntry)
            '        strmZipOutputStream.Write(abyBuffer, 0, abyBuffer.Length)
            '    Next

            '    For Each strFile In astrFileNames3
            '        Dim strmFile As FileStream = File.OpenRead(strFile)
            '        Dim abyBuffer(strmFile.Length - 1) As Byte

            '        strmFile.Read(abyBuffer, 0, abyBuffer.Length)


            '        Dim objZipEntry As ZipEntry = New ZipEntry("editme\" + Path.GetFileName(strFile))

            '        objZipEntry.DateTime = DateTime.Now
            '        objZipEntry.Size = strmFile.Length
            '        strmFile.Close()
            '        strmZipOutputStream.PutNextEntry(objZipEntry)
            '        strmZipOutputStream.Write(abyBuffer, 0, abyBuffer.Length)
            '    Next

            '    For Each strFile In astrFileNames4
            '        Dim strmFile As FileStream = File.OpenRead(strFile)
            '        Dim abyBuffer(strmFile.Length - 1) As Byte

            '        strmFile.Read(abyBuffer, 0, abyBuffer.Length)


            '        Dim objZipEntry As ZipEntry = New ZipEntry("utils_js\" + Path.GetFileName(strFile))

            '        objZipEntry.DateTime = DateTime.Now
            '        objZipEntry.Size = strmFile.Length
            '        strmFile.Close()
            '        strmZipOutputStream.PutNextEntry(objZipEntry)
            '        strmZipOutputStream.Write(abyBuffer, 0, abyBuffer.Length)
            '    Next


            '    strmZipOutputStream.Finish()
            '    strmZipOutputStream.Close()

            MessageBox.Show("Successfully Saved " + DirectoryBrowser.SelectedPath + "\" + projName + ".gg", "Google Desktop Gadget", MessageBoxButtons.OK, MessageBoxIcon.Information)

            openit.Enabled = True

            savedGadget = DirectoryBrowser.SelectedPath + "\" + projName + ".gg"

            statusSave = -1
        End If


    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim dlg As OpenFileDialog = New OpenFileDialog
        Dim res As DialogResult = dlg.ShowDialog()
        If res = DialogResult.OK Then
            Dim bm As New Bitmap(dlg.FileName)
            'PictureBox1.Image = Image.FromFile(dlg.FileName)
            'PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
            'System.IO.File.Copy(dlg.FileName.ToString, dirName)
        End If
    End Sub

    Private Sub MenuItem6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub MenuItem8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem8.Click
        MessageBox.Show("Developed by Umakanthan Chandran" & vbCrLf & "Bugs and ideas to cumakt@gmail.com", "OneClick Feed GD Gadget Generator", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
    End Sub

    Private Function utils_js() As String

        'Create a new StringBuilder object
        Dim sb As New StringBuilder

        sb.Append("/*" & vbCrLf)
        sb.Append("Copyright (C) 2007 Google Inc." & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("Licensed under the Apache License, Version 2.0 (the ""License"");" & vbCrLf)
        sb.Append("you may not use this file except in compliance with the License." & vbCrLf)
        sb.Append("You may obtain a copy of the License at" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("     http://www.apache.org/licenses/LICENSE-2.0" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("Unless required by applicable law or agreed to in writing, software" & vbCrLf)
        sb.Append("distributed under the License is distributed on an ""AS IS"" BASIS," & vbCrLf)
        sb.Append("WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied." & vbCrLf)
        sb.Append("See the License for the specific language governing permissions and" & vbCrLf)
        sb.Append("limitations under the License." & vbCrLf)
        sb.Append("*/" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// ---------------------- Utilities ------------------------" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Converts an RFC3339 date time into local time JS Date." & vbCrLf)
        sb.Append("// Returns null on error." & vbCrLf)
        sb.Append("function parseRFC3339(date) {" & vbCrLf)
        sb.Append("  var newDate = new Date();" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Parse date portion." & vbCrLf)
        sb.Append("  // first 10 chars 'XXXX-XX-XX'" & vbCrLf)
        sb.Append("  var datePart = date.substring(0, 10);" & vbCrLf)
        sb.Append("  datePart = datePart.split(""-"");" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  if (datePart.length != 3) {" & vbCrLf)
        sb.Append("    return null;" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  newDate.setUTCFullYear(datePart[0]);" & vbCrLf)
        sb.Append("  newDate.setUTCMonth(datePart[1] - 1);" & vbCrLf)
        sb.Append("  newDate.setUTCDate(datePart[2]);" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Check for 'T'." & vbCrLf)
        sb.Append("  var tPart = date.substring(10, 11);" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  if (tPart != 'T' && tPart != 't') {" & vbCrLf)
        sb.Append("    return null;" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Parse time portion." & vbCrLf)
        sb.Append("  // 'XX:XX:XX'" & vbCrLf)
        sb.Append("  var timePart = date.substring(11, 19);" & vbCrLf)
        sb.Append("  timePart = timePart.split("":"");" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  if (timePart.length != 3) {" & vbCrLf)
        sb.Append("    return null;" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  newDate.setUTCHours(timePart[0]);" & vbCrLf)
        sb.Append("  newDate.setUTCMinutes(timePart[1]);" & vbCrLf)
        sb.Append("  newDate.setUTCSeconds(timePart[2]);" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  var index = 19;" & vbCrLf)
        sb.Append("  var dateLen = date.length;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  if (date.charAt(index) == '.') {" & vbCrLf)
        sb.Append("    // Consume fractional sec." & vbCrLf)
        sb.Append("    do {" & vbCrLf)
        sb.Append("      ++index;" & vbCrLf)
        sb.Append("    } while (date.charAt(index) >= '0' &&" & vbCrLf)
        sb.Append("             date.charAt(index) <= '9' &&" & vbCrLf)
        sb.Append("             index < date.length);" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  if (index >= date.length) {" & vbCrLf)
        sb.Append("    // No zone to parse;" & vbCrLf)
        sb.Append("    return newDate;" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  if (date.charAt(index) == 'Z') {" & vbCrLf)
        sb.Append("    // No offset." & vbCrLf)
        sb.Append("    return newDate;" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  var offsetSign = date.charAt(index);" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  if (offsetSign != '+' && offsetSign != '-') {" & vbCrLf)
        sb.Append("    return null;" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  ++index;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Parse offset." & vbCrLf)
        sb.Append("  var offsetPart = date.substring(index, index + 5);" & vbCrLf)
        sb.Append("  offsetPart = offsetPart.split("":"");" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  if (offsetPart.length != 2) {" & vbCrLf)
        sb.Append("    return null;" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  var offsetSeconds = (Number(offsetPart[0]) * 60) + Number(offsetPart[1]);" & vbCrLf)
        sb.Append("  var offsetMs = offsetSeconds * 60 * 1000;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Adjust for offset." & vbCrLf)
        sb.Append("  if (offsetSign == '+') {" & vbCrLf)
        sb.Append("    newDate.setTime(newDate.getTime() - offsetMs);" & vbCrLf)
        sb.Append("  } else {" & vbCrLf)
        sb.Append("    newDate.setTime(newDate.getTime() + offsetMs);" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  return newDate;" & vbCrLf)
        sb.Append("}" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Formats date object similar to how contentarea displays dates, i.e.:" & vbCrLf)
        sb.Append("//   - 15 min ago" & vbCrLf)
        sb.Append("//   - 3 hrs ago" & vbCrLf)
        sb.Append("//   - 5 days ago" & vbCrLf)
        sb.Append("//" & vbCrLf)
        sb.Append("// Returns empty string on error." & vbCrLf)
        sb.Append("function formatDate(date) {" & vbCrLf)
        sb.Append("  if (!date) {" & vbCrLf)
        sb.Append("    return '';" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  var now = new Date();" & vbCrLf)
        sb.Append("  var value;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Difference between now and supplied date in ms." & vbCrLf)
        sb.Append("  var diff = now.getTime() - date.getTime();" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Convert to min." & vbCrLf)
        sb.Append("  diff = diff / (60 * 1000);" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Less than an hour." & vbCrLf)
        sb.Append("  if (diff < 60) {" & vbCrLf)
        sb.Append("    value = Math.floor(diff);" & vbCrLf)
        sb.Append("    return value + ' ' + (value > 1 ? strings.MINS_AGO : strings.MIN_AGO);" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Convert to hours." & vbCrLf)
        sb.Append("  diff = Math.floor(diff / 60);" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Less than a day." & vbCrLf)
        sb.Append("  if (diff < 24) {" & vbCrLf)
        sb.Append("    value = Math.floor(diff);" & vbCrLf)
        sb.Append("    return value + ' ' + (value > 1 ? strings.HRS_AGO : strings.HR_AGO);" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Convert to days." & vbCrLf)
        sb.Append("  value = Math.floor(diff / 24);" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Default unit is day." & vbCrLf)
        sb.Append("  return value + ' ' + (value > 1 ? strings.DAYS_AGO : strings.DAY_AGO);" & vbCrLf)
        sb.Append("}" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Retrieves an online image and executes callback with the response datastream" & vbCrLf)
        sb.Append("// as an argument." & vbCrLf)
        sb.Append("function retrieveImage(url, callback) {" & vbCrLf)
        sb.Append("  if (!url) {" & vbCrLf)
        sb.Append("    debug.trace('Invalid image url: ' + url);" & vbCrLf)
        sb.Append("    return;" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  debug.trace('Retrieving image: ' + url);" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  try {" & vbCrLf)
        sb.Append("    var request = new XMLHttpRequest();    request.open('GET', url, true);" & vbCrLf)
        sb.Append("    request.onreadystatechange = onReadyStateChange;" & vbCrLf)
        sb.Append("    request.send();" & vbCrLf)
        sb.Append("  } catch (e) {" & vbCrLf)
        sb.Append("    debug.trace('Can\'t retrieve image: ' + url);" & vbCrLf)
        sb.Append("    return;" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  function onReadyStateChange() {" & vbCrLf)
        sb.Append("    if (request.readyState != 4) {" & vbCrLf)
        sb.Append("      return;" & vbCrLf)
        sb.Append("    }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("    if (request.status == 200) {" & vbCrLf)
        sb.Append("      callback(request.responseStream);" & vbCrLf)
        sb.Append("    }" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("}" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// A shameful way to determine the dimensions (width/height) of an image." & vbCrLf)
        sb.Append("// - path: Path to image." & vbCrLf)
        sb.Append("//" & vbCrLf)
        sb.Append("// Returns an array with [width, height]." & vbCrLf)
        sb.Append("function getImageDimensions(path) {" & vbCrLf)
        sb.Append("  // NOTE: Uses a hidden ""img"" element defined in ""main.xml""." & vbCrLf)
        sb.Append("  imgSizer.src = path;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  return [imgSizer.srcWidth, imgSizer.srcHeight];" & vbCrLf)
        sb.Append("}" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Strips HTML and decodes common entities." & vbCrLf)
        sb.Append("function stripHtml(s) {" & vbCrLf)
        sb.Append("  s = s.replace(/(<([^>]*)>)/ig, '');" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  return s;" & vbCrLf)
        sb.Append("}" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Determines whether file is present in gadget package." & vbCrLf)
        sb.Append("function isFilePresent(path) {" & vbCrLf)
        sb.Append("  var result = gadget.storage.extract(path);" & vbCrLf)
        sb.Append("  " & vbCrLf)
        sb.Append("  return result !== '';" & vbCrLf)
        sb.Append("}" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// ""Pathify""s filename with given path." & vbCrLf)
        sb.Append("function pathify(path, filename) {" & vbCrLf)
        sb.Append("  return path + '\\' + filename;" & vbCrLf)
        sb.Append("}" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("function SimpleXmlParser(xmlDoc) {" & vbCrLf)
        sb.Append("  this.xmlDoc = xmlDoc; " & vbCrLf)
        sb.Append("  this.parseError = xmlDoc.parseError;" & vbCrLf)
        sb.Append("  if (this.parseError.errorCode !== 0) {" & vbCrLf)
        sb.Append("     debug.error(""SimpleXmlParser ERROR: "" + this.parseError.reason);" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("}" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("SimpleXmlParser.prototype.getItems = function(key) {" & vbCrLf)
        sb.Append("  var xmlDoc = this.xmlDoc;" & vbCrLf)
        sb.Append("  var items = [];" & vbCrLf)
        sb.Append("  if (this.parseError.errorCode !== 0) {" & vbCrLf)
        sb.Append("     debug.error(""SimpleXmlParser ERROR: "" + this.parseError.reason);" & vbCrLf)
        sb.Append("  } else {" & vbCrLf)
        sb.Append("     var objNodeList = xmlDoc.getElementsByTagName(key);" & vbCrLf)
        sb.Append("     for (var i = 0; i < objNodeList.length; ++i) {" & vbCrLf)
        sb.Append("       var xmlItem = objNodeList.item(i);" & vbCrLf)
        sb.Append("       var item = {};" & vbCrLf)
        sb.Append("       var added = false;" & vbCrLf)
        sb.Append("       for (var j = 0; j < xmlItem.childNodes.length; ++j) {" & vbCrLf)
        sb.Append("         var child = xmlItem.childNodes.item(j);" & vbCrLf)
        sb.Append("         if (child.childNodes.length > 0) {" & vbCrLf)
        sb.Append("           var name = child.nodeName;" & vbCrLf)
        sb.Append("           var value = child.childNodes[0].nodeValue;" & vbCrLf)
        sb.Append("           item[name] = value;" & vbCrLf)
        sb.Append("           added = true;" & vbCrLf)
        sb.Append("         }" & vbCrLf)
        sb.Append("       }" & vbCrLf)
        sb.Append("       if (added) {" & vbCrLf)
        sb.Append("         items.push(item);     " & vbCrLf)
        sb.Append("       }" & vbCrLf)
        sb.Append("     }" & vbCrLf)
        sb.Append("  } " & vbCrLf)
        sb.Append("  return items;" & vbCrLf)
        sb.Append("};" & vbCrLf)

        Return sb.ToString()
    End Function


    Private Function parsers_js() As String

        'Create a new StringBuilder object
        Dim sb As New StringBuilder

        sb.Append("/*" & vbCrLf)
        sb.Append("Copyright (C) 2007 Google Inc." & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("Licensed under the Apache License, Version 2.0 (the ""License"");" & vbCrLf)
        sb.Append("you may not use this file except in compliance with the License." & vbCrLf)
        sb.Append("You may obtain a copy of the License at" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("     http://www.apache.org/licenses/LICENSE-2.0" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("Unless required by applicable law or agreed to in writing, software" & vbCrLf)
        sb.Append("distributed under the License is distributed on an ""AS IS"" BASIS," & vbCrLf)
        sb.Append("WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied." & vbCrLf)
        sb.Append("See the License for the specific language governing permissions and" & vbCrLf)
        sb.Append("limitations under the License." & vbCrLf)
        sb.Append("*/" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// ---------------------- Default Parsers ------------------------" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Generates sequential IDs." & vbCrLf)
        sb.Append("//" & vbCrLf)
        sb.Append("// Some feeds do not provide entry IDs, however the gadget needs each entry" & vbCrLf)
        sb.Append("// to have a unique ID. When parsing a feed and encountering an ID-less entry," & vbCrLf)
        sb.Append("// use this to create an ID." & vbCrLf)
        sb.Append("var IdGenerator = new function() {" & vbCrLf)
        sb.Append("  this.nextId = 0;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  this.getNextId = function() {" & vbCrLf)
        sb.Append("    return this.nextId++;" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("}" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Attempts to automatically parse feed." & vbCrLf)
        sb.Append("// So far can detect and parse basic ATOM and RSS." & vbCrLf)
        sb.Append("//" & vbCrLf)
        sb.Append("// A parsed entry is a JS object and contains these fields:" & vbCrLf)
        sb.Append("//" & vbCrLf)
        sb.Append("// title - The entry title." & vbCrLf)
        sb.Append("// content - The description or summary." & vbCrLf)
        sb.Append("// link - The link to the entry." & vbCrLf)
        sb.Append("//" & vbCrLf)
        sb.Append("// And may contain values for these fields:" & vbCrLf)
        sb.Append("//" & vbCrLf)
        sb.Append("// published - Published date." & vbCrLf)
        sb.Append("// id - Unique identifier for the entry." & vbCrLf)
        sb.Append("//" & vbCrLf)
        sb.Append("// When finished, executes callback with array of parsed entries." & vbCrLf)
        sb.Append("function parseFeedDefault(responseText, callback) {" & vbCrLf)
        sb.Append("  debug.trace('Default feed parsing.');" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  var doc;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  try {" & vbCrLf)
        sb.Append("    doc = new DOMDocument();" & vbCrLf)
        sb.Append("    doc.loadXML(responseText);" & vbCrLf)
        sb.Append("  } catch(e) {" & vbCrLf)
        sb.Append("    debug.error('Could not load XML.');" & vbCrLf)
        sb.Append("    return;" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Get the top-level tag name." & vbCrLf)
        sb.Append("  var rootTagName = doc.documentElement.tagName;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  var entries;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  if (rootTagName == 'rss' || rootTagName =='channel') {" & vbCrLf)
        sb.Append("    entries = parseRSS(doc, CONFIG_MAX_ENTRIES);" & vbCrLf)
        sb.Append("  } else if (rootTagName == 'feed') {" & vbCrLf)
        sb.Append("    // ATOM has top level ""feed"" element." & vbCrLf)
        sb.Append("    entries = parseATOM(doc, CONFIG_MAX_ENTRIES);" & vbCrLf)
        sb.Append("  } else {" & vbCrLf)
        sb.Append("    debug.error('Unrecognized feed type.');" & vbCrLf)
        sb.Append("    return;" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  callback(entries);" & vbCrLf)
        sb.Append("}" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Generic RSS parser." & vbCrLf)
        sb.Append("// Returns array of data objects." & vbCrLf)
        sb.Append("function parseRSS(doc, maxEntries) {" & vbCrLf)
        sb.Append("  debug.trace('Parsing RSS feed.');" & vbCrLf)
        sb.Append("  var entries = [];" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  try {" & vbCrLf)
        sb.Append("    var entryElements = doc.getElementsByTagName('item');" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("    for (var i = 0; i < entryElements.length && i < maxEntries; ++i) {" & vbCrLf)
        sb.Append("      var entry = entryElements[i];" & vbCrLf)
        sb.Append("      var entryData = {};" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("      // ID." & vbCrLf)
        sb.Append("      if (entry.getElementsByTagName('guid').length > 0) {" & vbCrLf)
        sb.Append("        entryData['id'] = entry.getElementsByTagName('guid')[0].text;" & vbCrLf)
        sb.Append("      } else {" & vbCrLf)
        sb.Append("        entryData['id'] = IdGenerator.getNextId();" & vbCrLf)
        sb.Append("      }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("      // Entry title." & vbCrLf)
        sb.Append("      entryData['title'] = entry.getElementsByTagName('title')[0].text;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("      // Strip any possible HTML from title." & vbCrLf)
        sb.Append("      entryData['title'] = stripHtml(entryData['title']);" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("      // Publish date." & vbCrLf)
        sb.Append("      if (entry.getElementsByTagName('pubDate').length > 0) {" & vbCrLf)
        sb.Append("        var pubDate = entry.getElementsByTagName('pubDate')[0].text;" & vbCrLf)
        sb.Append("        entryData['published'] = new Date(pubDate);" & vbCrLf)
        sb.Append("      }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("      // Entry content." & vbCrLf)
        sb.Append("      entryData['content'] = entry.getElementsByTagName('description')[0].text;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("      // Link." & vbCrLf)
        sb.Append("      entryData['link'] = entry.getElementsByTagName('link')[0].text;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("      entries.push(entryData);" & vbCrLf)
        sb.Append("    }" & vbCrLf)
        sb.Append("  } catch(e) {" & vbCrLf)
        sb.Append("    debug.error('Error parsing RSS feed: ' + e.message);" & vbCrLf)
        sb.Append("    return;" & vbCrLf)
        sb.Append(" }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  debug.trace('Successfully parsed ' + entries.length + ' entries.');" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  return entries;" & vbCrLf)
        sb.Append("}" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Generic ATOM parser." & vbCrLf)
        sb.Append("// Returns array of data objects." & vbCrLf)
        sb.Append("function parseATOM(doc, maxEntries) {" & vbCrLf)
        sb.Append("  debug.trace('Parsing ATOM feed.');" & vbCrLf)
        sb.Append("  var entries = [];" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  try {" & vbCrLf)
        sb.Append("    var entryElements = doc.getElementsByTagName('entry');" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("    for (var i = 0; i < entryElements.length && i < maxEntries; ++i) {" & vbCrLf)
        sb.Append("      var entry = entryElements[i];" & vbCrLf)
        sb.Append("      var entryData = {};" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("      // ID." & vbCrLf)
        sb.Append("      entryData['id'] = entry.getElementsByTagName('id')[0].text;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("      // Entry title." & vbCrLf)
        sb.Append("      entryData['title'] = entry.getElementsByTagName('title')[0].text;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("      // Strip any possible HTML from title." & vbCrLf)
        sb.Append("      entryData['title'] = stripHtml(entryData['title']);" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("      // Published." & vbCrLf)
        sb.Append("      var published = entry.getElementsByTagName('published')[0].text;" & vbCrLf)
        sb.Append("      entryData['published'] = parseRFC3339(published);" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("      // Entry content." & vbCrLf)
        sb.Append("      entryData['content'] = entry.getElementsByTagName('content')[0].text;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("      // Get the alt link." & vbCrLf)
        sb.Append("      var linkElements = entry.getElementsByTagName('link');" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("      for (var j = 0; j < linkElements.length; ++j) {" & vbCrLf)
        sb.Append("        var link = linkElements[j];" & vbCrLf)
        sb.Append("        var rel = link.getAttribute('rel');" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("        if (rel == 'alternate') {" & vbCrLf)
        sb.Append("          entryData['link'] = link.getAttribute('href');" & vbCrLf)
        sb.Append("        }" & vbCrLf)
        sb.Append("      }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("      entries.push(entryData);" & vbCrLf)
        sb.Append("    }" & vbCrLf)
        sb.Append("  } catch(e) {" & vbCrLf)
        sb.Append("    debug.error('Error parsing ATOM feed: ' + e.message);" & vbCrLf)
        sb.Append("    return;" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  debug.trace('Successfully parsed ' + entries.length + ' entries.');" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  return entries;" & vbCrLf)
        sb.Append("}" & vbCrLf)

        Return sb.ToString()
    End Function


    Private Function entry_list_js() As String

        'Create a new StringBuilder object
        Dim sb As New StringBuilder

        sb.Append("/*" & vbCrLf)
        sb.Append("Copyright (C) 2007 Google Inc." & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("Licensed under the Apache License, Version 2.0 (the ""License"");" & vbCrLf)
        sb.Append("you may not use this file except in compliance with the License." & vbCrLf)
        sb.Append("You may obtain a copy of the License at" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("     http://www.apache.org/licenses/LICENSE-2.0" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("Unless required by applicable law or agreed to in writing, software" & vbCrLf)
        sb.Append("distributed under the License is distributed on an ""AS IS"" BASIS," & vbCrLf)
        sb.Append("WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied." & vbCrLf)
        sb.Append("See the License for the specific language governing permissions and" & vbCrLf)
        sb.Append("limitations under the License." & vbCrLf)
        sb.Append("*/" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("EntryList.FRAME_TOP_LEFT_IMAGE = 'frame_TopLeft.png';" & vbCrLf)
        sb.Append("EntryList.FRAME_TOP_MIDDLE_IMAGE = 'frame_TopMiddle.png';" & vbCrLf)
        sb.Append("EntryList.FRAME_TOP_RIGHT_IMAGE = 'frame_TopRight.png';" & vbCrLf)
        sb.Append("EntryList.FRAME_TOP_LOGO_IMAGE = 'frame_TopLogo.png';" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("EntryList.FRAME_MIDDLE_LEFT_IMAGE = 'frame_MiddleLeft.png';" & vbCrLf)
        sb.Append("EntryList.FRAME_MIDDLE_RIGHT_IMAGE = 'frame_MiddleRight.png';" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Filenames of alternative ""stretch"" images. If exists, gadget will use" & vbCrLf)
        sb.Append("// these instead and stretch instead of tiling." & vbCrLf)
        sb.Append("// Other option was to introduce new parameter in config_constants to" & vbCrLf)
        sb.Append("// control stretching vs. tiling." & vbCrLf)
        sb.Append("// Decided this would be better since it requires no code modifications on" & vbCrLf)
        sb.Append("// the designer's part." & vbCrLf)
        sb.Append("EntryList.FRAME_TOP_MIDDLE_STRETCH_IMAGE = 'frame_TopMiddleStretch.png';" & vbCrLf)
        sb.Append("EntryList.FRAME_BOTTOM_MIDDLE_STRETCH_IMAGE = 'frame_BottomMiddleStretch.png';" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("EntryList.FRAME_MIDDLE_LEFT_STRETCH_IMAGE = 'frame_MiddleLeftStretch.png';" & vbCrLf)
        sb.Append("EntryList.FRAME_MIDDLE_RIGHT_STRETCH_IMAGE = 'frame_MiddleRightStretch.png';" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("EntryList.FRAME_BOTTOM_LEFT_IMAGE = 'frame_BottomLeft.png';" & vbCrLf)
        sb.Append("EntryList.FRAME_BOTTOM_MIDDLE_IMAGE = 'frame_BottomMiddle.png';" & vbCrLf)
        sb.Append("EntryList.FRAME_BOTTOM_RIGHT_IMAGE = 'frame_BottomRight.png';" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("EntryList.SCROLLBAR_TRACK_IMAGE = 'scrollbar_track.png';" & vbCrLf)
        sb.Append("EntryList.SCROLLBAR_THUMB_IMAGE = 'scrollbar_thumb.png';" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Default entry hover background, if none specified in config." & vbCrLf)
        sb.Append("EntryList.DEFAULT_ENTRY_HOVER_BKG = '#FFFFFF';" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// XML file that describes title. The title is the area above content where" & vbCrLf)
        sb.Append("// arbritrary elements can be specified." & vbCrLf)
        sb.Append("EntryList.TITLE_FILE = 'title.xml';" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// The theme file that contains the XML template for an entry item." & vbCrLf)
        sb.Append("EntryList.ITEM_TEMPLATE_FILE = 'entry_item.xml';" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Configuration values for this theme." & vbCrLf)
        sb.Append("EntryList.CONFIG_FILE = 'theme_config.xml';" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Encapsulates the UI that displays feed entries." & vbCrLf)
        sb.Append("// Also manages sizing of scrollbar and frame." & vbCrLf)
        sb.Append("// - container: Container div, inner elements are defined in ""main.xml""." & vbCrLf)
        sb.Append("// - themeDir: directory path containing the desired ""theme""." & vbCrLf)
        sb.Append("function EntryList(container, themeDir) {" & vbCrLf)
        sb.Append("  this.container = container;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  this.content = this.container.children('content');" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // The title area." & vbCrLf)
        sb.Append("  this.title = this.container.children('title');" & vbCrLf)
        sb.Append("  " & vbCrLf)
        sb.Append("  // The div that wraps the entries (for clipping purposes)." & vbCrLf)
        sb.Append("  this.entryListViewport = this.content.children('entriesViewport');" & vbCrLf)
        sb.Append("  // The actual div that will contain the entries." & vbCrLf)
        sb.Append("  this.entryList = this.entryListViewport.children('entries');" & vbCrLf)
        sb.Append("  " & vbCrLf)
        sb.Append("  // The label that will contain text content." & vbCrLf)
        sb.Append("  this.statusLabel = this.content.children('statusLabel');" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  this.scrollbar = this.container.children('scrollbar');" & vbCrLf)
        sb.Append("  // The actual scrollbar is implemented with a progressbar." & vbCrLf)
        sb.Append("  this.scrollProgressBar = this.scrollbar.children('bar');" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Setup handlers for the progress bar events." & vbCrLf)
        sb.Append("  var me = this;" & vbCrLf)
        sb.Append("  this.scrollProgressBar.onchange = function() { me.onScroll(); };" & vbCrLf)
        sb.Append("  this.scrollProgressBar.onmousewheel = function() { me.onMouseWheel(); };" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  this.header = new HorizStretchImage(header);" & vbCrLf)
        sb.Append("  this.footer = new HorizStretchImage(footer);" & vbCrLf)
        sb.Append("  this.borderLeft = this.container.children('borderLeft');" & vbCrLf)
        sb.Append("  this.borderRight = this.container.children('borderRight');" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  this.logo = this.container.children('logo');" & vbCrLf)
        sb.Append("  this.logoImage = this.logo.children('image');" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  themeDir = themeDir || EntryList.DEFAULT_THEME_DIR;" & vbCrLf)
        sb.Append("  this.loadTheme(themeDir);" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // The current number of entries." & vbCrLf)
        sb.Append("  this.numItems = 0;" & vbCrLf)
        sb.Append("  // The height of the displayable content." & vbCrLf)
        sb.Append("  // Will be calculated in the resize method." & vbCrLf)
        sb.Append("  this.contentHeight = 0;" & vbCrLf)
        sb.Append("}" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Loads theme in the given directory." & vbCrLf)
        sb.Append("EntryList.prototype.loadTheme = function(themeDir) {" & vbCrLf)
        sb.Append("  // Read in the entry item template.      " & vbCrLf)
        sb.Append("  this.itemXml = gadget.storage.openText(" & vbCrLf)
        sb.Append("      pathify(themeDir, EntryList.ITEM_TEMPLATE_FILE));" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Read in header title XML." & vbCrLf)
        sb.Append("  this.titleXml = gadget.storage.openText(" & vbCrLf)
        sb.Append("      pathify(themeDir, EntryList.TITLE_FILE));" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Read in config XML.        " & vbCrLf)
        sb.Append("  var configXml = gadget.storage.openText(" & vbCrLf)
        sb.Append("      pathify(themeDir, EntryList.CONFIG_FILE));" & vbCrLf)
        sb.Append("  " & vbCrLf)
        sb.Append("  // Parse config and extract values." & vbCrLf)
        sb.Append("  var xmlDoc = new DOMDocument();" & vbCrLf)
        sb.Append("  xmlDoc.async = false;" & vbCrLf)
        sb.Append("  xmlDoc.loadXML(configXml);" & vbCrLf)
        sb.Append(" " & vbCrLf)
        sb.Append("  var parser = new SimpleXmlParser(xmlDoc);  " & vbCrLf)
        sb.Append("  var parsedItems = parser.getItems('config');" & vbCrLf)
        sb.Append("          " & vbCrLf)
        sb.Append("  // Set the entry hover background color." & vbCrLf)
        sb.Append("  if (parsedItems.length > 0 && parsedItems[0]['entryHoverBkg']) {" & vbCrLf)
        sb.Append("    this.entryHoverBkg = parsedItems[0]['entryHoverBkg'];" & vbCrLf)
        sb.Append("  } else {" & vbCrLf)
        sb.Append("    // Use the default." & vbCrLf)
        sb.Append("    this.entryHoverBkg = EntryList.DEFAULT_ENTRY_HOVER_BKG;    " & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("    " & vbCrLf)
        sb.Append("  // Insert title content into title area." & vbCrLf)
        sb.Append("  if (this.titleXml) {" & vbCrLf)
        sb.Append("    this.title.appendElement(this.titleXml);" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("  " & vbCrLf)
        sb.Append("  var headerMiddleImage;" & vbCrLf)
        sb.Append("  " & vbCrLf)
        sb.Append("  if (isFilePresent(" & vbCrLf)
        sb.Append("      pathify(themeDir, EntryList.FRAME_TOP_MIDDLE_STRETCH_IMAGE))) {" & vbCrLf)
        sb.Append("    this.header.setStretchMode(true);" & vbCrLf)
        sb.Append("    headerMiddleImage = " & vbCrLf)
        sb.Append("        pathify(themeDir, EntryList.FRAME_TOP_MIDDLE_STRETCH_IMAGE);" & vbCrLf)
        sb.Append("  } else {" & vbCrLf)
        sb.Append("    this.header.setStretchMode(false);    " & vbCrLf)
        sb.Append("    headerMiddleImage = pathify(themeDir, EntryList.FRAME_TOP_MIDDLE_IMAGE);" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("  " & vbCrLf)
        sb.Append("  this.header.setImages(pathify(themeDir, EntryList.FRAME_TOP_LEFT_IMAGE)," & vbCrLf)
        sb.Append("      headerMiddleImage," & vbCrLf)
        sb.Append("      pathify(themeDir, EntryList.FRAME_TOP_RIGHT_IMAGE));" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  this.logoImage.src = pathify(themeDir, EntryList.FRAME_TOP_LOGO_IMAGE);" & vbCrLf)
        sb.Append("  this.logoImage.width = this.logoImage.srcWidth;" & vbCrLf)
        sb.Append("  this.logo.height = this.logoImage.srcHeight;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  var footerMiddleImage;" & vbCrLf)
        sb.Append("  " & vbCrLf)
        sb.Append("  if (isFilePresent(pathify(themeDir, " & vbCrLf)
        sb.Append("                            EntryList.FRAME_BOTTOM_MIDDLE_STRETCH_IMAGE))) {" & vbCrLf)
        sb.Append("    this.footer.setStretchMode(true);" & vbCrLf)
        sb.Append("    footerMiddleImage = pathify(themeDir, " & vbCrLf)
        sb.Append("                                EntryList.FRAME_BOTTOM_MIDDLE_STRETCH_IMAGE);" & vbCrLf)
        sb.Append("  } else {" & vbCrLf)
        sb.Append("    this.footer.setStretchMode(false);    " & vbCrLf)
        sb.Append("    footerMiddleImage = pathify(themeDir, EntryList.FRAME_BOTTOM_MIDDLE_IMAGE);" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  this.footer.setImages(" & vbCrLf)
        sb.Append("      pathify(themeDir, EntryList.FRAME_BOTTOM_LEFT_IMAGE)," & vbCrLf)
        sb.Append("      footerMiddleImage," & vbCrLf)
        sb.Append("      pathify(themeDir, EntryList.FRAME_BOTTOM_RIGHT_IMAGE));" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Setup left border." & vbCrLf)
        sb.Append("  if (isFilePresent(" & vbCrLf)
        sb.Append("      pathify(themeDir, EntryList.FRAME_MIDDLE_LEFT_STRETCH_IMAGE))) {" & vbCrLf)
        sb.Append("    this.setupVerticalBorder(this.borderLeft, " & vbCrLf)
        sb.Append("        pathify(themeDir, EntryList.FRAME_MIDDLE_LEFT_STRETCH_IMAGE)," & vbCrLf)
        sb.Append("        true);" & vbCrLf)
        sb.Append("  } else {" & vbCrLf)
        sb.Append("    this.setupVerticalBorder(this.borderLeft, " & vbCrLf)
        sb.Append("        pathify(themeDir, EntryList.FRAME_MIDDLE_LEFT_IMAGE)," & vbCrLf)
        sb.Append("        false);" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Setup right border." & vbCrLf)
        sb.Append("  if (isFilePresent(" & vbCrLf)
        sb.Append("      pathify(themeDir, EntryList.FRAME_MIDDLE_RIGHT_STRETCH_IMAGE))) {" & vbCrLf)
        sb.Append("    this.setupVerticalBorder(this.borderRight, " & vbCrLf)
        sb.Append("        pathify(themeDir, EntryList.FRAME_MIDDLE_RIGHT_STRETCH_IMAGE)," & vbCrLf)
        sb.Append("        true);" & vbCrLf)
        sb.Append("  } else {" & vbCrLf)
        sb.Append("    this.setupVerticalBorder(this.borderRight, " & vbCrLf)
        sb.Append("        pathify(themeDir, EntryList.FRAME_MIDDLE_RIGHT_IMAGE)," & vbCrLf)
        sb.Append("        false);" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  this.scrollbar.background = pathify(themeDir, " & vbCrLf)
        sb.Append("      EntryList.SCROLLBAR_TRACK_IMAGE);" & vbCrLf)
        sb.Append("  this.scrollProgressBar.thumbImage = pathify(themeDir," & vbCrLf)
        sb.Append("      EntryList.SCROLLBAR_THUMB_IMAGE);" & vbCrLf)
        sb.Append("  this.scrollProgressBar.emptyImage = pathify(themeDir," & vbCrLf)
        sb.Append("      EntryList.SCROLLBAR_TRACK_IMAGE);" & vbCrLf)
        sb.Append("  this.scrollProgressBar.fullImage = pathify(themeDir," & vbCrLf)
        sb.Append("      EntryList.SCROLLBAR_TRACK_IMAGE);" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  this.scrollbar.width = getImageDimensions(this.scrollbar.background)[0];" & vbCrLf)
        sb.Append("  this.scrollProgressBar.width = this.scrollbar.width;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  this.resize(view.width, view.height);" & vbCrLf)
        sb.Append("};" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Loads an image into either left or right border." & vbCrLf)
        sb.Append("// - border: The div representing the border." & vbCrLf)
        sb.Append("// - imagePath: The path to the image." & vbCrLf)
        sb.Append("// - isStretch: Whether to setup the border to stretch or tile when resized." & vbCrLf)
        sb.Append("EntryList.prototype.setupVerticalBorder = function(" & vbCrLf)
        sb.Append("    border, imagePath, isStretch) {" & vbCrLf)
        sb.Append("  if (isStretch) {" & vbCrLf)
        sb.Append("    border.children('stretchImage').src = imagePath;" & vbCrLf)
        sb.Append("    border.width = border.children('stretchImage').srcWidth;	  " & vbCrLf)
        sb.Append("    border.background = '';    " & vbCrLf)
        sb.Append("  } else {" & vbCrLf)
        sb.Append("    border.background = imagePath;" & vbCrLf)
        sb.Append("    border.width = getImageDimensions(border.background)[0];" & vbCrLf)
        sb.Append("    border.children('stretchImage').src = '';" & vbCrLf)
        sb.Append("  }      " & vbCrLf)
        sb.Append("};" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Resizes border to specified height. " & vbCrLf)
        sb.Append("// - border: The div representing the border." & vbCrLf)
        sb.Append("// - height: The new height." & vbCrLf)
        sb.Append("EntryList.prototype.resizeVerticalBorder = function(border, height) {" & vbCrLf)
        sb.Append("  border.height = height;" & vbCrLf)
        sb.Append("  " & vbCrLf)
        sb.Append("  // Determine if it's stretch mode.  " & vbCrLf)
        sb.Append("  if (border.children('stretchImage').src) {  " & vbCrLf)
        sb.Append("    var stretchImageHeight = border.children('stretchImage').srcHeight;" & vbCrLf)
        sb.Append("    if (height > stretchImageHeight) {" & vbCrLf)
        sb.Append("      // When image is stretched beyond original size, edge of image fades." & vbCrLf)
        sb.Append("      // Need to extend the image slightly.      " & vbCrLf)
        sb.Append("      border.children('stretchImage').height = height + " & vbCrLf)
        sb.Append("          Math.sqrt(height - stretchImageHeight);" & vbCrLf)
        sb.Append("    } else {" & vbCrLf)
        sb.Append("      border.children('stretchImage').height = height;" & vbCrLf)
        sb.Append("    }" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("};  " & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Handles scrolling event (scrollbar changed value)." & vbCrLf)
        sb.Append("EntryList.prototype.onScroll = function() {" & vbCrLf)
        sb.Append("  // Bounds checks." & vbCrLf)
        sb.Append("  if (this.scrollProgressBar.value < 0) {" & vbCrLf)
        sb.Append("    this.scrollProgressBar.value = 0;" & vbCrLf)
        sb.Append("  } else if (this.scrollProgressBar.value > 100) {" & vbCrLf)
        sb.Append("    this.scrollProgressBar.value = 100;" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  var percentage = (this.scrollProgressBar.max - this.scrollProgressBar.value);" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Calculate the content scroll offset." & vbCrLf)
        sb.Append("  var offset = (percentage / 100) *" & vbCrLf)
        sb.Append("               (this.entryList.height - this.entryListViewport.height);" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Offset the entry list." & vbCrLf)
        sb.Append("  this.entryList.y = -offset;" & vbCrLf)
        sb.Append("};" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Handles mousewheel event." & vbCrLf)
        sb.Append("EntryList.prototype.onMouseWheel = function() {" & vbCrLf)
        sb.Append("  if (event.wheelDelta > 0) {" & vbCrLf)
        sb.Append("    // Up." & vbCrLf)
        sb.Append("    this.scrollProgressBar.value += this.getPageStep();" & vbCrLf)
        sb.Append("  } else {" & vbCrLf)
        sb.Append("    // Down." & vbCrLf)
        sb.Append("    this.scrollProgressBar.value -= this.getPageStep();" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // No bounds checks here, onScroll will do it." & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Refresh scrolling." & vbCrLf)
        sb.Append("  this.onScroll();" & vbCrLf)
        sb.Append("};" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Calculates the percentage (represented by an int between 0 and 100)" & vbCrLf)
        sb.Append("// of total content height that is in one visible page." & vbCrLf)
        sb.Append("EntryList.prototype.getPageStep = function() {" & vbCrLf)
        sb.Append("  if (this.entryList.height <= 0) {" & vbCrLf)
        sb.Append("    return 0;" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  return 100 * (this.entryListViewport.height / this.entryList.height);" & vbCrLf)
        sb.Append("};" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Clears entry list and displays a status message." & vbCrLf)
        sb.Append("EntryList.prototype.displayMessage = function(message) {" & vbCrLf)
        sb.Append("  this.clearItems();" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Ensure status message is visible." & vbCrLf)
        sb.Append("  this.statusLabel.visible = true;" & vbCrLf)
        sb.Append("  this.statusLabel.innerText = message;" & vbCrLf)
        sb.Append("};" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Adds an item to the entry list." & vbCrLf)
        sb.Append("EntryList.prototype.addItem = function(item) {" & vbCrLf)
        sb.Append("  debug.trace('Adding entry item.');" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // When there any items, hide status message." & vbCrLf)
        sb.Append("  this.statusLabel.visible = false;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  var listitem = this.entryList.appendElement(this.itemXml);" & vbCrLf)
        sb.Append("  var itemHeight = listitem.height;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  listitem.y = itemHeight * this.numItems;" & vbCrLf)
        sb.Append("  listitem.onclick = function() { itemOnClick(item); };" & vbCrLf)
        sb.Append("  listitem.ondblclick = function() { openEntryInBrowser(item.link); };" & vbCrLf)
        sb.Append("  " & vbCrLf)
        sb.Append("  var entryHoverBkg = this.entryHoverBkg;" & vbCrLf)
        sb.Append("  " & vbCrLf)
        sb.Append("  listitem.onmouseover = function() {" & vbCrLf)
        sb.Append("    listitem.background = entryHoverBkg;" & vbCrLf)
        sb.Append("  };" & vbCrLf)
        sb.Append("  listitem.onmouseout = function() { listitem.background = ''; };" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  var me = this;" & vbCrLf)
        sb.Append("  listitem.onmousewheel = function() { me.onMouseWheel(); };" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  this.fillItem(listitem, item);" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  ++this.numItems;" & vbCrLf)
        sb.Append("  this.entryList.height = itemHeight * this.numItems;" & vbCrLf)
        sb.Append("};" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Resize entry list to the given width and height." & vbCrLf)
        sb.Append("EntryList.prototype.resize = function(width, height) {" & vbCrLf)
        sb.Append("  this.container.width = width;" & vbCrLf)
        sb.Append("  this.container.height = height;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Resize the header." & vbCrLf)
        sb.Append("  this.header.resize(width);" & vbCrLf)
        sb.Append("  var headerHeight = this.header.getHeight();" & vbCrLf)
        sb.Append("  " & vbCrLf)
        sb.Append("  // Set title to same height as header." & vbCrLf)
        sb.Append("  this.title.height = headerHeight;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Resize and position the footer." & vbCrLf)
        sb.Append("  this.footer.resize(width);" & vbCrLf)
        sb.Append("  var footerHeight = this.footer.getHeight();" & vbCrLf)
        sb.Append("  var footerY = height - footerHeight;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  this.footer.setY(footerY);" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Check if footer is overlapping header." & vbCrLf)
        sb.Append("  if (footerY < headerHeight) {" & vbCrLf)
        sb.Append("    // It is overlapping, hide the footer." & vbCrLf)
        sb.Append("    this.footer.hide();" & vbCrLf)
        sb.Append("  } else {" & vbCrLf)
        sb.Append("    this.footer.show();" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Calculate and store height of content." & vbCrLf)
        sb.Append("  this.contentHeight = height - headerHeight - footerHeight;  " & vbCrLf)
        sb.Append("  " & vbCrLf)
        sb.Append("  // Width of area that consists of content and scrollbar (if present)." & vbCrLf)
        sb.Append("  var contentAndScrollWidth = width - this.borderRight.width -" & vbCrLf)
        sb.Append("      this.borderLeft.width;" & vbCrLf)
        sb.Append("      " & vbCrLf)
        sb.Append("  this.contentWidth = contentAndScrollWidth;" & vbCrLf)
        sb.Append("      " & vbCrLf)
        sb.Append("  // Set height of entry list viewport." & vbCrLf)
        sb.Append("  // Subtracting 2 to account for vertical padding." & vbCrLf)
        sb.Append("  this.entryListViewport.height = this.contentHeight - 2;" & vbCrLf)
        sb.Append("  this.entryListViewport.y = 1;  " & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // If the entry list viewport is bigger than the actual entry list." & vbCrLf)
        sb.Append("  if (this.entryListViewport.height > this.entryList.height) {" & vbCrLf)
        sb.Append("    // Hide and reset the scrollbar." & vbCrLf)
        sb.Append("    this.scrollbar.visible = false;" & vbCrLf)
        sb.Append("    this.scrollProgressBar.value = 100;" & vbCrLf)
        sb.Append("  } else {" & vbCrLf)
        sb.Append("    this.scrollbar.visible = true;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("    // Shorten the content width to account for the visible scrollbar." & vbCrLf)
        sb.Append("    this.contentWidth -= this.scrollbar.width;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("    // Resize and position the scrollbar container." & vbCrLf)
        sb.Append("    this.scrollbar.height = this.contentHeight;" & vbCrLf)
        sb.Append("    this.scrollbar.x =  width - this.borderRight.width -" & vbCrLf)
        sb.Append("        this.scrollProgressBar.width;" & vbCrLf)
        sb.Append("    this.scrollbar.y = headerHeight;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("    // Resize the progress bar." & vbCrLf)
        sb.Append("    this.scrollProgressBar.height = this.contentHeight;" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Resize and position the content." & vbCrLf)
        sb.Append("  this.content.height = this.contentHeight;" & vbCrLf)
        sb.Append("  this.content.width = this.contentWidth;" & vbCrLf)
        sb.Append("  this.content.x = this.borderLeft.width;" & vbCrLf)
        sb.Append("  this.content.y = headerHeight;" & vbCrLf)
        sb.Append("  " & vbCrLf)
        sb.Append("  // Align the title area to the content." & vbCrLf)
        sb.Append("  this.title.x = this.content.x;" & vbCrLf)
        sb.Append("  this.title.width = this.content.width;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  if (this.logo) {" & vbCrLf)
        sb.Append("    // Center the logo." & vbCrLf)
        sb.Append("    var logoImageWidth = this.logoImage.width;" & vbCrLf)
        sb.Append("    var logoX = this.borderLeft.width + " & vbCrLf)
        sb.Append("                ((contentAndScrollWidth - logoImageWidth) / 2);" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("    // Check if logo overlaps left border." & vbCrLf)
        sb.Append("    if (logoX < this.borderLeft.width) {" & vbCrLf)
        sb.Append("      logoX = this.borderLeft.width;" & vbCrLf)
        sb.Append("    }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("    this.logo.x = logoX;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("    // Match the logo width to that of the content (for clipping purposes)." & vbCrLf)
        sb.Append("    this.logo.width = contentAndScrollWidth;" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Padding for entries viewport." & vbCrLf)
        sb.Append("  // Same as content container less four for left & right padding." & vbCrLf)
        sb.Append("  // Don't have to set width of the inner entryList since it is width 100%." & vbCrLf)
        sb.Append("  this.entryListViewport.width = this.content.width - 4;  " & vbCrLf)
        sb.Append("  this.entryListViewport.x = 2;  " & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Position the left border." & vbCrLf)
        sb.Append("  this.borderLeft.x = 0;" & vbCrLf)
        sb.Append("  this.borderLeft.y = headerHeight;" & vbCrLf)
        sb.Append("  // Resize the left border." & vbCrLf)
        sb.Append("  this.resizeVerticalBorder(this.borderLeft, this.contentHeight);" & vbCrLf)
        sb.Append("  " & vbCrLf)
        sb.Append("  // Position the right border." & vbCrLf)
        sb.Append("  this.borderRight.x = width - this.borderRight.width;" & vbCrLf)
        sb.Append("  this.borderRight.y = headerHeight;" & vbCrLf)
        sb.Append("  // Resize the right border." & vbCrLf)
        sb.Append("  this.resizeVerticalBorder(this.borderRight, this.contentHeight);  " & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  this.afterResize();" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Refresh the scrolling." & vbCrLf)
        sb.Append("  this.onScroll();" & vbCrLf)
        sb.Append("};" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Removes all items." & vbCrLf)
        sb.Append("EntryList.prototype.clearItems = function() {" & vbCrLf)
        sb.Append("  this.numItems = 0;" & vbCrLf)
        sb.Append("  this.entryList.removeAllElements();" & vbCrLf)
        sb.Append("};" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Combination of images that will fit a given width." & vbCrLf)
        sb.Append("//" & vbCrLf)
        sb.Append("// Consists of 3 images:" & vbCrLf)
        sb.Append("//" & vbCrLf)
        sb.Append("// [      ][        ][ ]" & vbCrLf)
        sb.Append("// ^left   ^middle   ^right" & vbCrLf)
        sb.Append("//" & vbCrLf)
        sb.Append("// The middle image will be tiled or stretched to ensure all 3 images fill out " & vbCrLf)
        sb.Append("// the specified width." & vbCrLf)
        sb.Append("//" & vbCrLf)
        sb.Append("// By default the middle image will tile, but can set to stretch with" & vbCrLf)
        sb.Append("// ""setStretchMode""." & vbCrLf)
        sb.Append("function HorizStretchImage(container) {" & vbCrLf)
        sb.Append("  // The container div." & vbCrLf)
        sb.Append("  this.container = container;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // The left-side image." & vbCrLf)
        sb.Append("  this.left = this.container.children('left');" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // The middle image that will be tiled." & vbCrLf)
        sb.Append("  this.middle = this.container.children('middle');" & vbCrLf)
        sb.Append("  this.middle.x = this.left.width;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // The right-side image." & vbCrLf)
        sb.Append("  this.right = this.container.children('right');" & vbCrLf)
        sb.Append("  " & vbCrLf)
        sb.Append("  // Whether to tile or stretch the middle." & vbCrLf)
        sb.Append("  this.isStretch = false;" & vbCrLf)
        sb.Append("}" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("HorizStretchImage.prototype.setStretchMode = function(isStretch) {    " & vbCrLf)
        sb.Append("  this.isStretch = isStretch;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  this.middle.children('stretchImage').visible = this.isStretch;" & vbCrLf)
        sb.Append("};" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Set image sources with provided image paths." & vbCrLf)
        sb.Append("HorizStretchImage.prototype.setImages = function(left, middle, right) {" & vbCrLf)
        sb.Append("  this.left.src = left;" & vbCrLf)
        sb.Append("  this.left.width = this.left.srcWidth;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  this.container.height = this.left.srcHeight;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  if (this.isStretch) {" & vbCrLf)
        sb.Append("    this.middle.children('stretchImage').src = middle;" & vbCrLf)
        sb.Append("  } else {" & vbCrLf)
        sb.Append("    this.middle.background = middle;" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  this.right.src = right;" & vbCrLf)
        sb.Append("  this.right.width = this.right.srcWidth;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Images have changed, need to resize." & vbCrLf)
        sb.Append("  this.resize(this.container.width);" & vbCrLf)
        sb.Append("};" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Resize and stretch to specified width." & vbCrLf)
        sb.Append("HorizStretchImage.prototype.resize = function(width) {" & vbCrLf)
        sb.Append("  // Set the width of the container." & vbCrLf)
        sb.Append("  this.container.width = width;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Set the width of the middle (background will tile)." & vbCrLf)
        sb.Append("  this.middle.width = this.container.width -" & vbCrLf)
        sb.Append("      this.left.width - this.right.width;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  if (this.isStretch) {" & vbCrLf)
        sb.Append("    var newStretchWidth = this.middle.width;    " & vbCrLf)
        sb.Append("    var stretchImg = this.middle.children('stretchImage');" & vbCrLf)
        sb.Append("    " & vbCrLf)
        sb.Append("    // When image is stretched beyond original size, right edge of image fades." & vbCrLf)
        sb.Append("    // Need to enlarge the image slightly." & vbCrLf)
        sb.Append("    if (newStretchWidth > stretchImg.srcWidth) {" & vbCrLf)
        sb.Append("      newStretchWidth += Math.sqrt(newStretchWidth - stretchImg.srcWidth);" & vbCrLf)
        sb.Append("    }" & vbCrLf)
        sb.Append("    " & vbCrLf)
        sb.Append("    stretchImg.width = newStretchWidth;" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  this.middle.x = this.left.width;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Position the right-side image." & vbCrLf)
        sb.Append("  this.right.x = this.container.width - this.right.width;" & vbCrLf)
        sb.Append("};" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Returns the height." & vbCrLf)
        sb.Append("HorizStretchImage.prototype.getHeight = function() {" & vbCrLf)
        sb.Append("  return this.container.height;" & vbCrLf)
        sb.Append("};" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Set the Y position." & vbCrLf)
        sb.Append("HorizStretchImage.prototype.setY = function(y) {" & vbCrLf)
        sb.Append("  this.container.y = y;" & vbCrLf)
        sb.Append("};" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Hides the images." & vbCrLf)
        sb.Append("HorizStretchImage.prototype.hide = function() {" & vbCrLf)
        sb.Append("  this.container.visible = false;" & vbCrLf)
        sb.Append("};" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Unhides the images." & vbCrLf)
        sb.Append("HorizStretchImage.prototype.show = function() {" & vbCrLf)
        sb.Append("  this.container.visible = true;" & vbCrLf)
        sb.Append("};" & vbCrLf)

        Return sb.ToString()
    End Function


    Private Function config_constants_js(ByVal url As String, ByVal inter As String, ByVal max As String, ByVal cache As String) As String

        'Create a new StringBuilder object
        Dim sb As New StringBuilder

        sb.Append("/*" & vbCrLf)
        sb.Append("Copyright (C) 2007 Google Inc." & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("Licensed under the Apache License, Version 2.0 (the ""License"");" & vbCrLf)
        sb.Append("you may not use this file except in compliance with the License." & vbCrLf)
        sb.Append("You may obtain a copy of the License at" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("     http://www.apache.org/licenses/LICENSE-2.0" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("Unless required by applicable law or agreed to in writing, software" & vbCrLf)
        sb.Append("distributed under the License is distributed on an ""AS IS"" BASIS," & vbCrLf)
        sb.Append("WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied." & vbCrLf)
        sb.Append("See the License for the specific language governing permissions and" & vbCrLf)
        sb.Append("limitations under the License." & vbCrLf)
        sb.Append("*/" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// ---------------------- Configuration ------------------------" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Feed URL." & vbCrLf)
        sb.Append("var CONFIG_FEED_URL = '")
        sb.Append(url)
        sb.Append("';" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Set to true to add cache-buster (a random URL query parameter)" & vbCrLf)
        sb.Append("// to HTTP requests URLs." & vbCrLf)
        sb.Append("//" & vbCrLf)
        sb.Append("// Some servers will not like this and your request shall fail." & vbCrLf)
        sb.Append("var CONFIG_CACHE_BUSTER = ")
        sb.Append(cache)
        sb.Append(";" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Feed refresh interval in ms." & vbCrLf)
        sb.Append("var CONFIG_REFRESH_FEED_MS = ")
        sb.Append(inter)
        sb.Append("* 60 * 1000;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Maximum feed entries to parse and display." & vbCrLf)
        sb.Append("var CONFIG_MAX_ENTRIES = ")
        sb.Append(max)
        sb.Append(";" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Timeout length for HTTP requests in ms." & vbCrLf)
        sb.Append("var CONFIG_HTTP_REQUEST_TIMEOUT_MS = 5 * 1000;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Offline mode retry interval in ms." & vbCrLf)
        sb.Append("//" & vbCrLf)
        sb.Append("// The gadget enters offline mode when an HTTP request fails." & vbCrLf)
        sb.Append("// When in offline mode, the gadget will retry requests to the server" & vbCrLf)
        sb.Append("// more frequently, as set by this configuration value." & vbCrLf)
        sb.Append("//" & vbCrLf)
        sb.Append("// Highly recommended this value not be too small. One minute is probably" & vbCrLf)
        sb.Append("// the least it should be." & vbCrLf)
        sb.Append("var CONFIG_RETRY_DELAY_MS = 5 * 60 * 1000;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// The directory that contains the theme to be used." & vbCrLf)
        sb.Append("var CONFIG_THEME_DIR = 'default';" & vbCrLf)

        Return sb.ToString()
    End Function

    Private Function theme_config_xml(ByVal Color As String) As String

        'Create a new StringBuilder object
        Dim sb As New StringBuilder

        sb.Append("<!--" & vbCrLf)
        sb.Append("Copyright (C) 2007 Google Inc." & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("Licensed under the Apache License, Version 2.0 (the ""License"");" & vbCrLf)
        sb.Append("you may not use this file except in compliance with the License." & vbCrLf)
        sb.Append("You may obtain a copy of the License at" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("     http://www.apache.org/licenses/LICENSE-2.0" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("Unless required by applicable law or agreed to in writing, software" & vbCrLf)
        sb.Append("distributed under the License is distributed on an ""AS IS"" BASIS," & vbCrLf)
        sb.Append("WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied." & vbCrLf)
        sb.Append("See the License for the specific language governing permissions and" & vbCrLf)
        sb.Append("limitations under the License." & vbCrLf)
        sb.Append("-->" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("<config>" & vbCrLf)
        sb.Append("  <entryHoverBkg>")
        sb.Append(Color)
        sb.Append("</entryHoverBkg>" & vbCrLf)
        sb.Append("</config>" & vbCrLf)

        Return sb.ToString()
    End Function

    Private Function title_xml(ByVal titleG As String) As String

        'Create a new StringBuilder object
        Dim sb As New StringBuilder

        sb.Append("<!--" & vbCrLf)
        sb.Append("Copyright (C) 2007 Google Inc." & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("Licensed under the Apache License, Version 2.0 (the ""License"");" & vbCrLf)
        sb.Append("you may not use this file except in compliance with the License." & vbCrLf)
        sb.Append("You may obtain a copy of the License at" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("     http://www.apache.org/licenses/LICENSE-2.0" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("Unless required by applicable law or agreed to in writing, software" & vbCrLf)
        sb.Append("distributed under the License is distributed on an ""AS IS"" BASIS," & vbCrLf)
        sb.Append("WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied." & vbCrLf)
        sb.Append("See the License for the specific language governing permissions and" & vbCrLf)
        sb.Append("limitations under the License." & vbCrLf)
        sb.Append("-->" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("<label y=""7"" " & vbCrLf)
        sb.Append("       color=""#323F4C"" " & vbCrLf)
        sb.Append("       size=""9""" & vbCrLf)
        sb.Append("       bold=""true"">")
        sb.Append(titleG)
        sb.Append("</label>" & vbCrLf)

        Return sb.ToString()
    End Function


    Private Function entry_item_xml(ByVal Color As String) As String

        'Create a new StringBuilder object
        Dim sb As New StringBuilder

        sb.Append("<!--" & vbCrLf)
        sb.Append("Copyright (C) 2007 Google Inc." & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("Licensed under the Apache License, Version 2.0 (the ""License"");" & vbCrLf)
        sb.Append("you may not use this file except in compliance with the License." & vbCrLf)
        sb.Append("You may obtain a copy of the License at" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("     http://www.apache.org/licenses/LICENSE-2.0" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("Unless required by applicable law or agreed to in writing, software" & vbCrLf)
        sb.Append("distributed under the License is distributed on an ""AS IS"" BASIS," & vbCrLf)
        sb.Append("WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied." & vbCrLf)
        sb.Append("See the License for the specific language governing permissions and" & vbCrLf)
        sb.Append("limitations under the License." & vbCrLf)
        sb.Append("-->" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("<div height=""45"" width=""100%""" & vbCrLf)
        sb.Append("     enabled=""true"" >" & vbCrLf)
        sb.Append("	<label name=""title""" & vbCrLf)
        sb.Append("	    color=""")
        sb.Append(Color)
        sb.Append("""" & vbCrLf)
        sb.Append("	    wordWrap=""true""" & vbCrLf)
        sb.Append("	    width=""100%""" & vbCrLf)
        sb.Append("	    height=""26""" & vbCrLf)
        sb.Append("	    trimming=""word-ellipsis""" & vbCrLf)
        sb.Append("	    valign=""top""" & vbCrLf)
        sb.Append("	    size=""8"" />" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("	<label name=""published""" & vbCrLf)
        sb.Append("	    color=""#666666""" & vbCrLf)
        sb.Append("	    y=""26""" & vbCrLf)
        sb.Append("	    align=""right""" & vbCrLf)
        sb.Append("	    width=""100%""" & vbCrLf)
        sb.Append("	    valign=""top""" & vbCrLf)
        sb.Append("	    size=""8"" />" & vbCrLf)
        sb.Append("</div>" & vbCrLf)

        Return sb.ToString()
    End Function
    Private Function entry_item_impl_js() As String

        'Create a new StringBuilder object
        Dim sb As New StringBuilder

        sb.Append("/*" & vbCrLf)
        sb.Append("Copyright (C) 2007 Google Inc." & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("Licensed under the Apache License, Version 2.0 (the ""License"");" & vbCrLf)
        sb.Append("you may not use this file except in compliance with the License." & vbCrLf)
        sb.Append("You may obtain a copy of the License at" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("     http://www.apache.org/licenses/LICENSE-2.0" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("Unless required by applicable law or agreed to in writing, software" & vbCrLf)
        sb.Append("distributed under the License is distributed on an ""AS IS"" BASIS," & vbCrLf)
        sb.Append("WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied." & vbCrLf)
        sb.Append("See the License for the specific language governing permissions and" & vbCrLf)
        sb.Append("limitations under the License." & vbCrLf)
        sb.Append("*/" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// ---------------------- Custom Code ------------------------" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// There are three functions defined here that can be modified to implement" & vbCrLf)
        sb.Append("// custom entry items." & vbCrLf)
        sb.Append("//" & vbCrLf)
        sb.Append("// 1) parseFeed: Responsible for parsing the feed." & vbCrLf)
        sb.Append("//    Called with the response data after a feed is retrieved." & vbCrLf)
        sb.Append("//    Parses the response text and returns an array of data objects." & vbCrLf)
        sb.Append("//    The data objects will be the contents of the entry list." & vbCrLf)
        sb.Append("//" & vbCrLf)
        sb.Append("// 2) EntryList.prototype.fillItem:" & vbCrLf)
        sb.Append("//    Responsible for filling in the entry item." & vbCrLf)
        sb.Append("//" & vbCrLf)
        sb.Append("//    For example: if your 'listitem.xml' looks like this:" & vbCrLf)
        sb.Append("//      <div height=""50"" width=""100%"" enabled=""true"" >" & vbCrLf)
        sb.Append("//        <label width=""100%"" name=""foo"" />" & vbCrLf)
        sb.Append("//      </div>" & vbCrLf)
        sb.Append("//" & vbCrLf)
        sb.Append("//    Then ""fillItem"" should set the value of the label:" & vbCrLf)
        sb.Append("//      listitem.children('foo').innerText = 'some value';" & vbCrLf)
        sb.Append("//" & vbCrLf)
        sb.Append("// 3) EntryList.prototype.afterResize: Called after an entry item is added." & vbCrLf)
        sb.Append("//    Typically used to manage layout of entry items." & vbCrLf)
        sb.Append("//" & vbCrLf)
        sb.Append("// These functions and ""listitem.xml"" allow customization of the" & vbCrLf)
        sb.Append("// entry list items." & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Parses the feed into an array of data objects." & vbCrLf)
        sb.Append("// Executes callback when finished." & vbCrLf)
        sb.Append("function parseFeed(responseText, callback) {" & vbCrLf)
        sb.Append("  debug.trace('Parsing feed.');" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Call default parsing function that will parse most ATOM and RSS feeds." & vbCrLf)
        sb.Append("  // If you wish to parse manually, remove this line and replace with" & vbCrLf)
        sb.Append("  // your own code.  You may be able to copy and modify the code from" & vbCrLf)
        sb.Append("  // ""parseAtom"" or ""parseRSS"" from utils_js/parsers.js" & vbCrLf)
        sb.Append("  parseFeedDefault(responseText, callback);" & vbCrLf)
        sb.Append("}" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Fills in the contents of an entry item." & vbCrLf)
        sb.Append("//" & vbCrLf)
        sb.Append("// Modify this function if you have entry items with non-standard" & vbCrLf)
        sb.Append("// UI elements or custom entry data." & vbCrLf)
        sb.Append("EntryList.prototype.fillItem = function(listitem, item) {" & vbCrLf)
        sb.Append("  var title = listitem.children('title');" & vbCrLf)
        sb.Append("  var published = listitem.children('published');" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  title.innerText = item.title;" & vbCrLf)
        sb.Append("  published.innerText = formatDate(item.published);" & vbCrLf)
        sb.Append("};" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Called after the EntryList is resized." & vbCrLf)
        sb.Append("// Commonly used to layout entry items." & vbCrLf)
        sb.Append("//" & vbCrLf)
        sb.Append("// For example, if you have elements that need to stretch or be positioned" & vbCrLf)
        sb.Append("// in a specific manner, you would adjust those elements according to" & vbCrLf)
        sb.Append("// the provided width and height." & vbCrLf)
        sb.Append("//" & vbCrLf)
        sb.Append("// - width: EntryList width." & vbCrLf)
        sb.Append("// - height: EntryList height." & vbCrLf)
        sb.Append("EntryList.prototype.afterResize = function(width, height) {" & vbCrLf)
        sb.Append("};" & vbCrLf)

        Return sb.ToString()
    End Function


    Private Function details_css(ByVal Color As String) As String

        'Create a new StringBuilder object
        Dim sb As New StringBuilder

        sb.Append("/*" & vbCrLf)
        sb.Append("Copyright (C) 2007 Google Inc." & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("Licensed under the Apache License, Version 2.0 (the ""License"");" & vbCrLf)
        sb.Append("you may not use this file except in compliance with the License." & vbCrLf)
        sb.Append("You may obtain a copy of the License at" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("     http://www.apache.org/licenses/LICENSE-2.0" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("Unless required by applicable law or agreed to in writing, software" & vbCrLf)
        sb.Append("distributed under the License is distributed on an ""AS IS"" BASIS," & vbCrLf)
        sb.Append("WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied." & vbCrLf)
        sb.Append("See the License for the specific language governing permissions and" & vbCrLf)
        sb.Append("limitations under the License." & vbCrLf)
        sb.Append("*/" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("body {" & vbCrLf)
        sb.Append("	font-family: arial,sans-serif;" & vbCrLf)
        sb.Append("	font-size: 12px;" & vbCrLf)
        sb.Append("	color: ")
        sb.Append(Color)
        sb.Append(";" & vbCrLf)
        sb.Append("}" & vbCrLf)

        Return sb.ToString()
    End Function

    Private Function strings_xml() As String

        'Create a new StringBuilder object
        Dim sb As New StringBuilder

        sb.Append("<!--" & vbCrLf)
        sb.Append("Copyright (C) 2007 Google Inc." & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("Licensed under the Apache License, Version 2.0 (the ""License"");" & vbCrLf)
        sb.Append("you may not use this file except in compliance with the License." & vbCrLf)
        sb.Append("You may obtain a copy of the License at" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("     http://www.apache.org/licenses/LICENSE-2.0" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("Unless required by applicable law or agreed to in writing, software" & vbCrLf)
        sb.Append("distributed under the License is distributed on an ""AS IS"" BASIS," & vbCrLf)
        sb.Append("WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied." & vbCrLf)
        sb.Append("See the License for the specific language governing permissions and" & vbCrLf)
        sb.Append("limitations under the License." & vbCrLf)
        sb.Append("-->" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("<strings>" & vbCrLf)
        sb.Append("  <GADGET_ABOUT_TEXT>" & vbCrLf)
        sb.Append("  " & vbCrLf)
        sb.Append(wiz.authorAbout)
        sb.Append("  </GADGET_ABOUT_TEXT>" & vbCrLf)
        sb.Append("  " & vbCrLf)
        sb.Append("Copyright 2007 Google Inc." & vbCrLf)
        sb.Append("Licensed under the Apache License, Version 2.0" & vbCrLf)
        sb.Append("http://www.apache.org/licenses/LICENSE-2.0" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  <MIN_AGO>min ago</MIN_AGO>" & vbCrLf)
        sb.Append("  <MINS_AGO>mins ago</MINS_AGO>" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  <HR_AGO>hr ago</HR_AGO>" & vbCrLf)
        sb.Append("  <HRS_AGO>hrs ago</HRS_AGO>" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  <DAY_AGO>day ago</DAY_AGO>" & vbCrLf)
        sb.Append("  <DAYS_AGO>days ago</DAYS_AGO>" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  <TRYING_TO_CONNECT>Trying to connect...</TRYING_TO_CONNECT>" & vbCrLf)
        sb.Append("  " & vbCrLf)
        sb.Append("  <TITLE_TEXT>RSS Demo</TITLE_TEXT>  " & vbCrLf)
        sb.Append("</strings>" & vbCrLf)

        Return sb.ToString()
    End Function



    Private Function gadget_gmanifest(ByVal name As String) As String

        'Create a new StringBuilder object
        Dim sb As New StringBuilder

        sb.Append("<gadget minimumGoogleDesktopVersion=""5.1.0.0"">" & vbCrLf)
        sb.Append("	<about>" & vbCrLf)
        sb.Append("		<name>")
        sb.Append(name)
        sb.Append("</name>" & vbCrLf)
        sb.Append("		<description>")
        sb.Append(wiz.authorDesc)
        sb.Append("</description>" & vbCrLf)
        'sb.Append("		<aboutText>")
        'sb.Append("Now Its Under Problem")
        'sb.Append("</aboutText>" & vbCrLf)
        sb.Append("    <aboutText>&GADGET_ABOUT_TEXT;</aboutText>" & vbCrLf)
        sb.Append("		<smallIcon>icon_small.png</smallIcon>" & vbCrLf)
        sb.Append("		<icon>icon_large.png</icon>" & vbCrLf)
        sb.Append("		<version>")
        sb.Append(wiz.authorVersion)
        sb.Append("</version>" & vbCrLf)
        sb.Append("		<author>")
        sb.Append(wiz.authorName)
        sb.Append("</author>" & vbCrLf)
        sb.Append("		<authorWebsite>")
        sb.Append(wiz.authorSite)
        sb.Append("</authorWebsite>" & vbCrLf)
        Dim MyGuid As Guid = Guid.NewGuid()
        sb.Append("		<id>")
        sb.Append(MyGuid.ToString)
        sb.Append("</id>" & vbCrLf)
        sb.Append("    <authorEmail>")
        sb.Append(wiz.authorMail)
        sb.Append("</authorEmail>" & vbCrLf)
        sb.Append("    <copyright>Copyright (c) 2007 Google Inc. All Rights Reserved</copyright>" & vbCrLf)
        sb.Append("  </about>" & vbCrLf)
        sb.Append("</gadget>" & vbCrLf)

        Return sb.ToString()

    End Function

    Private Function main_js(ByVal flags As String) As String

        'Create a new StringBuilder object
        Dim sb As New StringBuilder

        sb.Append("/*" & vbCrLf)
        sb.Append("Copyright (C) 2007 Google Inc." & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("Licensed under the Apache License, Version 2.0 (the ""License"");" & vbCrLf)
        sb.Append("you may not use this file except in compliance with the License." & vbCrLf)
        sb.Append("You may obtain a copy of the License at" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("     http://www.apache.org/licenses/LICENSE-2.0" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("Unless required by applicable law or agreed to in writing, software" & vbCrLf)
        sb.Append("distributed under the License is distributed on an ""AS IS"" BASIS," & vbCrLf)
        sb.Append("WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied." & vbCrLf)
        sb.Append("See the License for the specific language governing permissions and" & vbCrLf)
        sb.Append("limitations under the License." & vbCrLf)
        sb.Append("*/" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// ---------------------- Global variables/objects ------------------------" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// EntryList object." & vbCrLf)
        sb.Append("// Manages the UI:" & vbCrLf)
        sb.Append("//  - The frame" & vbCrLf)
        sb.Append("//  - The content" & vbCrLf)
        sb.Append("//  - Adding entry items to the list" & vbCrLf)
        sb.Append("//  - Scrolling" & vbCrLf)
        sb.Append("var entryList;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Entries received from the feed." & vbCrLf)
        sb.Append("var lastEntries;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// The theme file that contains the CSS for the details view." & vbCrLf)
        sb.Append("var DETAILS_CSS_FILE = 'details.css';" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// The CSS styles to use in the details view." & vbCrLf)
        sb.Append("var detailsCss;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// The current entry displayed in the details view." & vbCrLf)
        sb.Append("var currentEntry = null;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// ---------------------- Gadget events ------------------------" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("function onOpen() {" & vbCrLf)
        sb.Append("  // Read in the details view CSS." & vbCrLf)
        sb.Append("  detailsCss = gadget.storage.openText(" & vbCrLf)
        sb.Append("      pathify(CONFIG_THEME_DIR, DETAILS_CSS_FILE));" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Create the EntryList." & vbCrLf)
        sb.Append("  entryList = new EntryList(container, CONFIG_THEME_DIR);" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Call draw with no data to display default error message." & vbCrLf)
        sb.Append("  draw(null);" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Refresh (request feed and then re-draw)." & vbCrLf)
        sb.Append("  refresh();" & vbCrLf)
        sb.Append("  // Run-forever timer that refreshes the feed." & vbCrLf)
        sb.Append("  view.setInterval(refresh, CONFIG_REFRESH_FEED_MS);" & vbCrLf)
        sb.Append("}" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Entry item onclick handler." & vbCrLf)
        sb.Append("function itemOnClick(entry) {" & vbCrLf)
        sb.Append("  debug.trace('Entry item onclick event.');" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Is a details view already open?" & vbCrLf)
        sb.Append("  if (currentEntry !== null) {" & vbCrLf)
        sb.Append("    var previousEntry = currentEntry;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("    // We explicitly close so we know for sure that ""currentEntry"" is" & vbCrLf)
        sb.Append("    // null at this point." & vbCrLf)
        sb.Append("    pluginHelper.closeDetailsView();" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("    // Same entry as before, no need to open it again." & vbCrLf)
        sb.Append("    if (previousEntry == entry) {" & vbCrLf)
        sb.Append("      return;" & vbCrLf)
        sb.Append("    }" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  currentEntry = entry;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  var htmlDetailsView = new DetailsView();" & vbCrLf)
        sb.Append("  htmlDetailsView.html_content = true;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  var htmlContent = '<style type=""text/css"">' + detailsCss + '</style>';" & vbCrLf)
        sb.Append("  htmlContent += entry.content;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  htmlDetailsView.setContent('', undefined, htmlContent, false, 0);" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // Show the details view" & vbCrLf)
        sb.Append("  pluginHelper.showDetailsView(htmlDetailsView," & vbCrLf)
        sb.Append("      entry.title," & vbCrLf)
        sb.Append(flags)
        sb.Append("," & vbCrLf)
        sb.Append("      function(flags) { detailsViewOnFeedback(flags, entry.link); });" & vbCrLf)
        sb.Append("}" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("function openEntryInBrowser(url) {" & vbCrLf)
        sb.Append("  var winShell = new ActiveXObject('Shell.Application');" & vbCrLf)
        sb.Append("  winShell.ShellExecute(url);" & vbCrLf)
        sb.Append("}" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Handles when details view is closed." & vbCrLf)
        sb.Append("// Here we want to open a link to the entry if the title bar is clicked." & vbCrLf)
        sb.Append("function detailsViewOnFeedback(flags, url) {" & vbCrLf)
        sb.Append("  currentEntry = null;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  debug.trace('detailsViewOnFeedback event.');" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  // User clicked on the title bar link." & vbCrLf)
        sb.Append("  if (flags == gddDetailsViewFlagToolbarOpen) {" & vbCrLf)
        sb.Append("    openEntryInBrowser(url);" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("}" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("function onSize() {" & vbCrLf)
        sb.Append("  entryList.resize(view.width, view.height);" & vbCrLf)
        sb.Append("}" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// ---------------------- Feed retrieval and parsing ------------------------" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("function refresh() {" & vbCrLf)
        sb.Append("  debug.trace('Refreshing feed.');" & vbCrLf)
        sb.Append("  retrieveFeed(CONFIG_FEED_URL, draw);" & vbCrLf)
        sb.Append("}" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Requests a feed and executes 'callback' when finished." & vbCrLf)
        sb.Append("function retrieveFeed(url, callback) {" & vbCrLf)
        sb.Append("  var request = new XMLHttpRequest();" & vbCrLf)
        sb.Append("  request.onreadystatechange = onReadyStateChange;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  if (CONFIG_CACHE_BUSTER) {" & vbCrLf)
        sb.Append("    url += '?cache_buster_xyz=' + Math.random();" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  debug.trace('Opening request to: ' + url);" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  function onRequestError() {" & vbCrLf)
        sb.Append("    request.abort();" & vbCrLf)
        sb.Append("    debug.trace('Request error, will retry later.');" & vbCrLf)
        sb.Append("    // Retry again later." & vbCrLf)
        sb.Append("    view.setTimeout(refresh, getRetryDelay());" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  try {" & vbCrLf)
        sb.Append("    request.open('GET', url, true);" & vbCrLf)
        sb.Append("    request.send();" & vbCrLf)
        sb.Append("  } catch(e) {" & vbCrLf)
        sb.Append("    debug.trace('Could not retrieve feed: ' + e.message);" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("    // If there are no entries, we want to call the retry function." & vbCrLf)
        sb.Append("    if (!lastEntries) {" & vbCrLf)
        sb.Append("      onRequestError();" & vbCrLf)
        sb.Append("    }" & vbCrLf)
        sb.Append("    return;" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  var timeoutTimer = null;" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  if (!lastEntries) {" & vbCrLf)
        sb.Append("    // Want to set a timeout since no data is available." & vbCrLf)
        sb.Append("    // If request timesout, call onRequestError to retry." & vbCrLf)
        sb.Append("    timeoutTimer = view.setTimeout(" & vbCrLf)
        sb.Append("        onRequestError," & vbCrLf)
        sb.Append("        CONFIG_HTTP_REQUEST_TIMEOUT_MS);" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  function onReadyStateChange() {" & vbCrLf)
        sb.Append("    if (request.readyState != 4) {" & vbCrLf)
        sb.Append("      return;" & vbCrLf)
        sb.Append("    }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("    if (request.status == 200) {" & vbCrLf)
        sb.Append("      if (timeoutTimer) {" & vbCrLf)
        sb.Append("        debug.trace('Cancelling request timeout timer.');" & vbCrLf)
        sb.Append("        view.clearTimeout(timeoutTimer);" & vbCrLf)
        sb.Append("      }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("      debug.trace('Retrieve succeeded.');" & vbCrLf)
        sb.Append("      parseFeed(request.responseText, callback);" & vbCrLf)
        sb.Append("    }" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("}" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// Extracted to a function: in the future we may want more intelligent" & vbCrLf)
        sb.Append("// delay (i.e. backoff)." & vbCrLf)
        sb.Append("function getRetryDelay() {" & vbCrLf)
        sb.Append("  return CONFIG_RETRY_DELAY_MS;" & vbCrLf)
        sb.Append("}" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("// ---------------------- Drawing code ------------------------" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("function draw(entries) {" & vbCrLf)
        sb.Append("  entryList.clearItems();" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  debug.trace('Adding entries.');" & vbCrLf)
        sb.Append("  // If no entry data, indicate error." & vbCrLf)
        sb.Append("  if (!entries) {" & vbCrLf)
        sb.Append("    debug.trace('No entries data, displaying default error.');" & vbCrLf)
        sb.Append("    entryList.displayMessage(strings.TRYING_TO_CONNECT);" & vbCrLf)
        sb.Append("  } else {" & vbCrLf)
        sb.Append("    for (var i = 0; i < entries.length && i < CONFIG_MAX_ENTRIES; ++i) {" & vbCrLf)
        sb.Append("      entryList.addItem(entries[i]);" & vbCrLf)
        sb.Append("    }" & vbCrLf)
        sb.Append("    lastEntries = entries;" & vbCrLf)
        sb.Append("  }" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  entryList.resize(view.width, view.height);" & vbCrLf)
        sb.Append("}" & vbCrLf)

        Return sb.ToString()
    End Function
    Private Function main_xml() As String

        'Create a new StringBuilder object
        Dim sb As New StringBuilder

        sb.Append("<!--" & vbCrLf)
        sb.Append("Copyright (C) 2007 Google Inc." & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("Licensed under the Apache License, Version 2.0 (the ""License"");" & vbCrLf)
        sb.Append("you may not use this file except in compliance with the License." & vbCrLf)
        sb.Append("You may obtain a copy of the License at" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("     http://www.apache.org/licenses/LICENSE-2.0" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("Unless required by applicable law or agreed to in writing, software" & vbCrLf)
        sb.Append("distributed under the License is distributed on an ""AS IS"" BASIS," & vbCrLf)
        sb.Append("WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied." & vbCrLf)
        sb.Append("See the License for the specific language governing permissions and" & vbCrLf)
        sb.Append("limitations under the License." & vbCrLf)
        sb.Append("-->" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("<view width=""136"" height=""155"" onopen=""onOpen()"" onsize=""onSize()"" resizable=""true"">" & vbCrLf)
        sb.Append("  <script src=""editme/config_constants.js"" />" & vbCrLf)
        sb.Append("  <script src=""utils_js/utils.js"" />" & vbCrLf)
        sb.Append("  <script src=""utils_js/parsers.js"" />" & vbCrLf)
        sb.Append("  <script src=""utils_js/entry_list.js"" />" & vbCrLf)
        sb.Append("  <script src=""main.js"" />" & vbCrLf)
        sb.Append("  <script src=""editme/entry_item_impl.js"" />" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  <div name=""container"">" & vbCrLf)
        sb.Append("    <!-- Content -->" & vbCrLf)
        sb.Append("    <div name=""content""" & vbCrLf)
        sb.Append("         background=""#FFFFFF"">" & vbCrLf)
        sb.Append("      <!-- Entry container -->" & vbCrLf)
        sb.Append("      <div name=""entriesViewPort"">" & vbCrLf)
        sb.Append("        <div name=""entries"" width=""100%"" />" & vbCrLf)
        sb.Append("      </div>" & vbCrLf)
        sb.Append("      <!-- Status label -->" & vbCrLf)
        sb.Append("      <label name=""statusLabel"" size=""8"" />" & vbCrLf)
        sb.Append("    </div>" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("    <!-- Scrollbar -->" & vbCrLf)
        sb.Append("    <div name=""scrollbar""" & vbCrLf)
        sb.Append("         enabled=""false"">" & vbCrLf)
        sb.Append("      <progressbar name=""bar""" & vbCrLf)
        sb.Append("                   cursor=""hand""" & vbCrLf)
        sb.Append("                   enabled=""true""" & vbCrLf)
        sb.Append("                   value=""100""" & vbCrLf)
        sb.Append("                   orientation=""vertical"" />" & vbCrLf)
        sb.Append("    </div>" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("    <!-- Frame -->" & vbCrLf)
        sb.Append("    <div name=""header"">" & vbCrLf)
        sb.Append("      <img name=""left"" />" & vbCrLf)
        sb.Append("      <div name=""middle"" height=""100%"">" & vbCrLf)
        sb.Append("        <img name=""stretchImage"" width=""100%"" />" & vbCrLf)
        sb.Append("      </div>      " & vbCrLf)
        sb.Append("      <img name=""right"" />" & vbCrLf)
        sb.Append("    </div>" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("    <div name=""logo"">" & vbCrLf)
        sb.Append("      <img name=""image"" />" & vbCrLf)
        sb.Append("    </div>" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("    <div name=""borderLeft"">" & vbCrLf)
        sb.Append("      <img name=""stretchImage"" height=""100%"" />" & vbCrLf)
        sb.Append("    </div>" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("    <div name=""borderRight"">" & vbCrLf)
        sb.Append("      <img name=""stretchImage"" height=""100%"" />    " & vbCrLf)
        sb.Append("    </div>    " & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("    <div name=""footer"">" & vbCrLf)
        sb.Append("      <img name=""left"" />" & vbCrLf)
        sb.Append("      <div name=""middle"" height=""100%"">" & vbCrLf)
        sb.Append("        <img name=""stretchImage"" width=""100%"" />" & vbCrLf)
        sb.Append("      </div>      " & vbCrLf)
        sb.Append("      <img name=""right"" />" & vbCrLf)
        sb.Append("    </div>" & vbCrLf)
        sb.Append("    " & vbCrLf)
        sb.Append("    <!-- Title -->" & vbCrLf)
        sb.Append("    <div name=""title"" width=""100%"" />" & vbCrLf)
        sb.Append("  </div>" & vbCrLf)
        sb.Append("" & vbCrLf)
        sb.Append("  <!-- See ""getImageDimensions"" in utils.js -->" & vbCrLf)
        sb.Append("  <img name=""imgSizer"" width=""0"" height=""0"" />" & vbCrLf)
        sb.Append("</view>" & vbCrLf)

        Return sb.ToString()
    End Function

    Private Sub openit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles openit.Click
        'Dim fileName As String
        'fileName = "C:\Temp\" + projectName.Text + "\gadget.gmanifest"

        Process.Start(savedGadget)

    End Sub

    Private Sub PictureBox12_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox12.Click
        Dim dlg As New OpenFileDialog
        With dlg
            .Filter = "Png files (*.png)|*.png"
            .FilterIndex = 1
            .Title = "Select any image for gadget icon"

        End With
        Dim res As DialogResult = dlg.ShowDialog()

        'dlg.Filter = "Png files (*.png)|*.png"
        If res = DialogResult.OK Then

            Dim objImage As System.Drawing.Image
            objImage = System.Drawing.Image.FromFile(dlg.FileName)
            Dim objCallback As System.Drawing.Image.GetThumbnailImageAbort = New System.Drawing.Image.GetThumbnailImageAbort(AddressOf ThumbnailCallback)

            objImage = objImage.GetThumbnailImage(32, 32, objCallback, IntPtr.Zero)

            PictureBox12.Image = objImage
            'PictureBox12.SizeMode = PictureBoxSizeMode.StretchImage
        End If
    End Sub
    Function ThumbnailCallback() As Boolean
        Return False
    End Function

    Private Sub PictureBox13_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox13.Click
        Dim dlg As New OpenFileDialog
        With dlg
            .Filter = "Png files (*.png)|*.png"
            .FilterIndex = 1
            .Title = "Select any image file for gadget icon"
        End With

        Dim res As DialogResult = dlg.ShowDialog()
        dlg.Filter = "Png files (*.png)|*.png"
        If res = DialogResult.OK Then
            Dim objImage As System.Drawing.Image
            objImage = System.Drawing.Image.FromFile(dlg.FileName)
            Dim objCallback As System.Drawing.Image.GetThumbnailImageAbort = New System.Drawing.Image.GetThumbnailImageAbort(AddressOf ThumbnailCallback)

            objImage = objImage.GetThumbnailImage(24, 24, objCallback, IntPtr.Zero)

            PictureBox13.Image = objImage
            PictureBox13.SizeMode = PictureBoxSizeMode.StretchImage
        End If
    End Sub

    Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
        projectName.Text = ""
        feedbox.Text = ""
        openit.Enabled = False
        saveit.Enabled = False

    End Sub

    Private Sub saveit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles saveit.Click
        Dim DirectoryBrowser As System.Windows.Forms.FolderBrowserDialog
        DirectoryBrowser = New System.Windows.Forms.FolderBrowserDialog
        DirectoryBrowser.Description = "Save Gadget in ..."
        If (DirectoryBrowser.ShowDialog() = Windows.Forms.DialogResult.OK) Then

            Dim ggZip As New ICSharpCode.SharpZipLib.Zip.FastZip
            ggZip.CreateZip(DirectoryBrowser.SelectedPath + "\" + projName + ".gg", dirName, True, "", "")
            MessageBox.Show("Successfully Saved " + DirectoryBrowser.SelectedPath + "\" + projName + ".gg", "Google Desktop Gadget", MessageBoxButtons.OK, MessageBoxIcon.Information)
            openit.Enabled = True
            savedGadget = DirectoryBrowser.SelectedPath + "\" + projName + ".gg"
        End If
    End Sub

    Private Sub MenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem5.Click
        Me.Close()
        Application.Exit()
    End Sub

    Private Sub removeitems_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles removeitems.CheckedChanged
        If (removeitems.CheckState = 1) Then
            showItems.CheckState = CheckState.Unchecked
        End If

    End Sub

    Private Sub showItems_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles showItems.CheckedChanged
        If (showItems.CheckState = 1) Then
            removeitems.CheckState = CheckState.Unchecked
        End If

    End Sub

    Private Sub maxentry_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles maxentry.ValueChanged
        If (maxentry.Value < 5) Then
            maxentry.Value = 5
        End If
        If (maxentry.Value > 25) Then
            maxentry.Value = 25
        End If
    End Sub

    Private Sub interval_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles interval.ValueChanged
        If (interval.Value < 1) Then
            interval.Value = 1
        End If
    End Sub

    Private Sub preview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles preview.Click
        ListBox1.ForeColor = displaycolor.BackColor
        detFeed.ForeColor = detailViewColor.BackColor

        If (projectName.Text.Length > 0) Then
            If (feedbox.Text.Length > 0) Then
                Try
                    Timer1.Enabled = True

                    mainBox.Visible = False
                    detailBox.Visible = False
                    preview.Visible = False
                    genGadget.Visible = False


                    ProgressBar1.Visible = True
                    Dim rssDataSet As New DataSet
                    rssDataSet.ReadXml(feedbox.Text)
                    grd1.DataMember = "item"
                    grd1.DataSource = rssDataSet
                    grdTemp = grd1
                    For i = 0 To 10
                        ProgressBar1.Value += 5
                        titleUrlFeed(i) = RemoveRemain(grdTemp.Item(i, 0))
                        feedUrl(i) = grdTemp.Item(i, 1)
                        detailsFeed(i) = grdTemp.Item(i, 3)
                        ListBox1.Items.Add(titleUrlFeed(i))
                    Next
                Catch x As Exception
                    x.GetBaseException()
                    alert("Please Check your Internet Connection & Feed URL")
                    prevBox.Visible = True
                    ListBox1.Items.Clear()
                    ProgressBar1.Visible = False
                Finally
                End Try
            End If
        ElseIf (projectName.Text.Length <= 0) Then
            MessageBox.Show("Please Enter Project Name,URL", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning)
            Exit Sub
        ElseIf (feedbox.Text.Length <= 0) Then
            MessageBox.Show("Please Enter Project Name,URL", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning)
            Exit Sub
        End If

        Timer1.Enabled = False
        ProgressBar1.Visible = False

        Timer1.Stop()
        prevBox.Visible = True

    End Sub

    Private Function alert(ByVal msg As String)
        MessageBox.Show(msg)
    End Function

    Private Function RemoveHTMLTags() As String
        Return Regex.Replace(detFeed.Text, "<[^>]*>", "")
    End Function
    Private Function RemoveRemain(ByVal str As String) As String
        Return Regex.Replace(str, "&(.{2,6});", "")
    End Function


    Private Sub PictureBox14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox14.Click

    End Sub

    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        detFeed.Text = detailsFeed(ListBox1.SelectedIndex)
        detFeed.Text = RemoveHTMLTags()
        detFeed.Text = RemoveRemain(detFeed.Text)
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        mainBox.Visible = True
        detailBox.Visible = True
        preview.Visible = True
        genGadget.Visible = True
        prevBox.Visible = False
        ListBox1.Items.Clear()
        ProgressBar1.Value = 0
    End Sub


    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If ProgressBar1.Value >= 200 Then
            ProgressBar1.Value = 0
        End If
        Return

    End Sub


    Private Sub cache_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles cache.MouseHover
        ToolTip1.SetToolTip(cache, "Set to true to add cache-buster (a random URL query parameter)to HTTP requests URLs. " & vbCrLf + "Some servers will not like this and your request shall fail.")
    End Sub



    Private Sub feedbox_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles feedbox.MouseHover
        ToolTip1.SetToolTip(feedbox, "Enter the Feed url here")
    End Sub


    Private Sub projectName_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles projectName.MouseHover
        ToolTip1.SetToolTip(projectName, "Project name here , Gadget will be generated by this name")
    End Sub


    Private Sub Label4_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label4.MouseHover
        ToolTip1.SetToolTip(Label4, "Feed refresh interval in Mintues")
    End Sub

    Private Sub Label6_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label6.MouseHover
        ToolTip1.SetToolTip(Label6, "Maximum feed entries to parse and display.")
    End Sub

    Private Sub PictureBox16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub
    Private Function GetWebColor(ByVal colorValue As Integer) As String

        Dim clr As Color
        clr = Color.FromArgb(colorValue)
        Dim wc As String = ColorTranslator.ToHtml(clr).ToString()
        Return wc

    End Function


    Private Sub detailViewColor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles detailViewColor.Click
        Dim dlgColor1 As New System.Windows.Forms.ColorDialog
        'dlgColor1 = New System.Windows.Forms.ColorDialog
        ' Initialize the color dialog's custom colors.
        If dlgColor1.ShowDialog() = DialogResult.OK Then
            detailViewColor.BackColor = dlgColor1.Color
            'alert(dlgColor.Color.ToArgb)
            detailTextColor = GetWebColor(dlgColor1.Color.ToArgb)
        End If
    End Sub

    Private Sub displaycolor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles displaycolor.Click
        Dim dlgColor As System.Windows.Forms.ColorDialog
        dlgColor = New System.Windows.Forms.ColorDialog
        ' Initialize the color dialog's custom colors.
        If dlgColor.ShowDialog() = DialogResult.OK Then
            displaycolor.BackColor = dlgColor.Color
            'alert(dlgColor.Color.ToArgb)
            feedTextColor = GetWebColor(dlgColor.Color.ToArgb)
        End If
    End Sub

    Private Sub mouseOverColor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mouseOverColor.Click
        Dim dlgColor2 As New System.Windows.Forms.ColorDialog
        'dlgColor1 = New System.Windows.Forms.ColorDialog
        ' Initialize the color dialog's custom colors.
        If dlgColor2.ShowDialog() = DialogResult.OK Then
            mouseOverColor.BackColor = dlgColor2.Color
            'alert(dlgColor.Color.ToArgb)
            mouseOColor = GetWebColor(dlgColor2.Color.ToArgb)
        End If
    End Sub

    Private Sub Label8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label8.Click

    End Sub

    Private Sub removeitems_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles removeitems.MouseHover
        ToolTip1.SetToolTip(removeitems, "Add a 'Remove' button in the details view. ")

    End Sub

    Private Sub showItems_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles showItems.MouseHover
        ToolTip1.SetToolTip(showItems, "Add a negative feedback button in the details view (e.g. 'Don't show me items like this').")
    End Sub

    Private Sub CheckBox1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.MouseHover
        ToolTip1.SetToolTip(CheckBox1, "Add a button in the details view which displays the friends list when clicked, and the user can share the content item with them.")
    End Sub

    Private Sub cache_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cache.CheckedChanged

    End Sub

    Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
        If (statusSave = 0) Then
            If MessageBox.Show("Do you want to save the generated gadget ?", "Not Saved", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) = DialogResult.OK Then
                Dim DirectoryBrowser As System.Windows.Forms.FolderBrowserDialog
                DirectoryBrowser = New System.Windows.Forms.FolderBrowserDialog
                DirectoryBrowser.Description = "Save Gadget in ..."
                If (DirectoryBrowser.ShowDialog() = Windows.Forms.DialogResult.OK) Then
                    Dim fz As New ICSharpCode.SharpZipLib.Zip.FastZip
                    fz.CreateZip(DirectoryBrowser.SelectedPath + "\" + projName + ".gg", dirName, True, "", "")
                    MessageBox.Show("Successfully Saved " + DirectoryBrowser.SelectedPath + "\" + projName + ".gg", "Google Desktop Gadget", MessageBoxButtons.OK, MessageBoxIcon.Information)

                    openit.Enabled = True
                    savedGadget = DirectoryBrowser.SelectedPath + "\" + projName + ".gg"
                    statusSave = -1
                Else
                    Me.Close()
                    Application.Exit()
                End If
            End If
        End If
    End Sub

    Private Sub mainBox_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mainBox.Enter

    End Sub
End Class

